1
0
mirror of https://github.com/git/git.git synced 2024-09-22 16:01:57 +02:00

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
This commit is contained in:
Junio C Hamano 2017-04-23 22:07:44 -07:00
commit 6b51cb6181

13
http.c
View File

@ -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"));