summaryrefslogtreecommitdiff
path: root/src/transports/http.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transports/http.c')
-rw-r--r--src/transports/http.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/transports/http.c b/src/transports/http.c
index 4aca2755b..bae2a328d 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -10,11 +10,13 @@
#include "http_parser.h"
#include "buffer.h"
#include "netops.h"
+#include "remote.h"
#include "smart.h"
#include "auth.h"
#include "auth_negotiate.h"
#include "tls_stream.h"
#include "socket_stream.h"
+#include "curl_stream.h"
git_http_auth_scheme auth_schemes[] = {
{ GIT_AUTHTYPE_NEGOTIATE, "Negotiate", GIT_CREDTYPE_DEFAULT, git_http_auth_negotiate },
@@ -532,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) &&
@@ -547,7 +550,11 @@ static int http_connect(http_subtransport *t)
if (t->connection_data.use_ssl) {
error = git_tls_stream_new(&t->io, t->connection_data.host, t->connection_data.port);
} else {
+#ifdef GIT_CURL
+ error = git_curl_stream_new(&t->io, t->connection_data.host, t->connection_data.port);
+#else
error = git_socket_stream_new(&t->io, t->connection_data.host, t->connection_data.port);
+#endif
}
if (error < 0)
@@ -555,9 +562,18 @@ 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)
+#if defined(GIT_OPENSSL) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CURL)
if ((!error || error == GIT_ECERTIFICATE) && t->owner->certificate_check_cb != NULL &&
git_stream_is_encrypted(t->io)) {
git_cert *cert;