From: Junio C Hamano Date: Thu, 28 Dec 2017 22:08:50 +0000 (-0800) Subject: Merge branch 'ws/curl-http-proxy-over-https' X-Git-Tag: v2.16.0-rc0~3 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/fc4a226bf60be67bc3d574aeafe06d266f700d99?ds=inline;hp=-c Merge branch 'ws/curl-http-proxy-over-https' Git has been taught to support an https:// URL used for http.proxy when using recent versions of libcurl. * ws/curl-http-proxy-over-https: http: support CURLPROXY_HTTPS --- fc4a226bf60be67bc3d574aeafe06d266f700d99 diff --combined http.c index 215bebef1b,9f98b56f22..32d33261c9 --- a/http.c +++ b/http.c @@@ -12,7 -12,6 +12,7 @@@ #include "gettext.h" #include "transport.h" #include "packfile.h" +#include "protocol.h" static struct trace_key trace_curl = TRACE_KEY_INIT(CURL); #if LIBCURL_VERSION_NUM >= 0x070a08 @@@ -865,6 -864,11 +865,11 @@@ static CURL *get_curl_handle(void else if (starts_with(curl_http_proxy, "socks")) curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); + #endif + #if LIBCURL_VERSION_NUM >= 0x073400 + else if (starts_with(curl_http_proxy, "https")) + curl_easy_setopt(result, + CURLOPT_PROXYTYPE, CURLPROXY_HTTPS); #endif if (strstr(curl_http_proxy, "://")) credential_from_url(&proxy_auth, curl_http_proxy); @@@ -899,21 -903,6 +904,21 @@@ static void set_from_env(const char **v *var = val; } +static void protocol_http_header(void) +{ + if (get_protocol_version_config() > 0) { + struct strbuf protocol_header = STRBUF_INIT; + + strbuf_addf(&protocol_header, GIT_PROTOCOL_HEADER ": version=%d", + get_protocol_version_config()); + + + extra_http_headers = curl_slist_append(extra_http_headers, + protocol_header.buf); + strbuf_release(&protocol_header); + } +} + void http_init(struct remote *remote, const char *url, int proactive_auth) { char *low_speed_limit; @@@ -944,8 -933,6 +949,8 @@@ if (remote) var_override(&http_proxy_authmethod, remote->http_proxy_authmethod); + protocol_http_header(); + pragma_header = curl_slist_append(http_copy_default_headers(), "Pragma: no-cache"); no_pragma_header = curl_slist_append(http_copy_default_headers(),