diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-04-23 22:07:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-23 22:07:44 -0700 |
commit | 6b51cb61812c11915dbcc1d6daeee60ac77297de (patch) | |
tree | 7437484708ae15e7960872ddf0df6802337051af /http.c | |
parent | 6a2c2f8d34fa1e8f3bb85d159d354810ed63692e (diff) | |
parent | ae51d91105981888f58ad21825b4ef0c540032e3 (diff) | |
download | git-6b51cb61812c11915dbcc1d6daeee60ac77297de.tar.gz |
Merge branch 'sr/http-proxy-configuration-fix'
"http.proxy" set to an empty string is used to disable the usage of
proxy. We broke this early last year.
* sr/http-proxy-configuration-fix:
http: fix the silent ignoring of proxy misconfiguraion
http: honor empty http.proxy option to bypass proxy
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -836,8 +836,14 @@ static CURL *get_curl_handle(void) } } - if (curl_http_proxy) { - curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy); + if (curl_http_proxy && curl_http_proxy[0] == '\0') { + /* + * Handle case with the empty http.proxy value here to keep + * common code clean. + * NB: empty option disables proxying at all. + */ + curl_easy_setopt(result, CURLOPT_PROXY, ""); + } else if (curl_http_proxy) { #if LIBCURL_VERSION_NUM >= 0x071800 if (starts_with(curl_http_proxy, "socks5h")) curl_easy_setopt(result, @@ -861,6 +867,9 @@ static CURL *get_curl_handle(void) strbuf_release(&url); } + if (!proxy_auth.host) + die("Invalid proxy URL '%s'", curl_http_proxy); + curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host); #if LIBCURL_VERSION_NUM >= 0x071304 var_override(&curl_no_proxy, getenv("NO_PROXY")); |