Skip to content

Commit

Permalink
http: set the proxy if the stream supports it
Browse files Browse the repository at this point in the history
Of the built-in ones, only cURL support it, but there's no reason a
user-provided stream wouldn't support it.
  • Loading branch information
carlosmn committed Jun 7, 2015
1 parent 59b6140 commit 923014a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/transports/http.c
Expand Up @@ -10,6 +10,7 @@
#include "http_parser.h"
#include "buffer.h"
#include "netops.h"
#include "remote.h"
#include "smart.h"
#include "auth.h"
#include "auth_negotiate.h"
Expand Down Expand Up @@ -533,6 +534,7 @@ static int write_chunk(git_stream *io, const char *buffer, size_t len)
static int http_connect(http_subtransport *t)
{
int error;
char *proxy_url;

if (t->connected &&
http_should_keep_alive(&t->parser) &&
Expand Down Expand Up @@ -560,6 +562,15 @@ static int http_connect(http_subtransport *t)

GITERR_CHECK_VERSION(t->io, GIT_STREAM_VERSION, "git_stream");

if (git_stream_supports_proxy(t->io) &&
!git_remote__get_http_proxy(t->owner->owner, !!t->connection_data.use_ssl, &proxy_url)) {
error = git_stream_set_proxy(t->io, proxy_url);
git__free(proxy_url);

if (error < 0)
return error;
}

error = git_stream_connect(t->io);

#if defined(GIT_OPENSSL) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CURL)
Expand Down

0 comments on commit 923014a

Please sign in to comment.