curl: remove the encrypted param to the constructor We do not want libcurl to perform the TLS negotiation for us, so we don't need to pass this option.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
diff --git a/src/curl_stream.c b/src/curl_stream.c
index 906a67f..6534bdb 100644
--- a/src/curl_stream.c
+++ b/src/curl_stream.c
@@ -195,7 +195,7 @@ static void curls_free(git_stream *stream)
git__free(s);
}
-int git_curl_stream_new(git_stream **out, const char *host, const char *port, int encrypted)
+int git_curl_stream_new(git_stream **out, const char *host, const char *port)
{
curl_stream *st;
CURL *handle;
@@ -213,15 +213,7 @@ int git_curl_stream_new(git_stream **out, const char *host, const char *port, in
if ((error = git__strtol32(&iport, port, NULL, 10)) < 0)
return error;
- if (encrypted) {
- git_buf buf = GIT_BUF_INIT;
- git_buf_printf(&buf, "https://%s", host);
- curl_easy_setopt(handle, CURLOPT_URL, buf.ptr);
- git_buf_free(&buf);
- } else {
- curl_easy_setopt(handle, CURLOPT_URL, host);
- }
-
+ curl_easy_setopt(handle, CURLOPT_URL, host);
curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, st->curl_error);
curl_easy_setopt(handle, CURLOPT_PORT, iport);
curl_easy_setopt(handle, CURLOPT_CONNECT_ONLY, 1);
@@ -232,7 +224,7 @@ int git_curl_stream_new(git_stream **out, const char *host, const char *port, in
/* curl_easy_setopt(handle, CURLOPT_VERBOSE, 1); */
st->parent.version = GIT_STREAM_VERSION;
- st->parent.encrypted = encrypted;
+ st->parent.encrypted = 0; /* we don't encrypt ourselves */
st->parent.proxy_support = 1;
st->parent.connect = curls_connect;
st->parent.certificate = curls_certificate;
diff --git a/src/curl_stream.h b/src/curl_stream.h
index 168fbe8..283f0fe 100644
--- a/src/curl_stream.h
+++ b/src/curl_stream.h
@@ -9,6 +9,6 @@
#include "git2/sys/stream.h"
-extern int git_curl_stream_new(git_stream **out, const char *host, const char *port, bool encrypted);
+extern int git_curl_stream_new(git_stream **out, const char *host, const char *port);
#endif
diff --git a/src/openssl_stream.c b/src/openssl_stream.c
index 3967440..412dee7 100644
--- a/src/openssl_stream.c
+++ b/src/openssl_stream.c
@@ -427,7 +427,7 @@ int git_openssl_stream_new(git_stream **out, const char *host, const char *port)
GITERR_CHECK_ALLOC(st);
#ifdef GIT_CURL
- error = git_curl_stream_new(&st->io, host, port, false);
+ error = git_curl_stream_new(&st->io, host, port);
#else
error = git_socket_stream_new(&st->io, host, port)
#endif
diff --git a/src/transports/http.c b/src/transports/http.c
index 39b286c..bae2a32 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -551,7 +551,7 @@ static int http_connect(http_subtransport *t)
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, false);
+ 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