Skip to content

Commit ae51d91

Browse files
rsa9000gitster
authored andcommitted
http: fix the silent ignoring of proxy misconfiguraion
Earlier, the whole http.proxy option string was passed to curl without any preprocessing so curl could complain about the invalid proxy configuration. After the commit 372370f ("http: use credential API to handle proxy authentication", 2016-01-26), if the user specified an invalid HTTP proxy option in the configuration, then the option parsing silently fails and NULL will be passed to curl as a proxy. This forces curl to fall back to detecting the proxy configuration from the environment, causing the http.proxy option ignoring. Fix this issue by checking the proxy option parsing result. If parsing failed then print an error message and die. Such behaviour allows the user to quickly figure the proxy misconfiguration and correct it. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 5741508 commit ae51d91

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

http.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,9 @@ static CURL *get_curl_handle(void)
867867
strbuf_release(&url);
868868
}
869869

870+
if (!proxy_auth.host)
871+
die("Invalid proxy URL '%s'", curl_http_proxy);
872+
870873
curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);
871874
#if LIBCURL_VERSION_NUM >= 0x071304
872875
var_override(&curl_no_proxy, getenv("NO_PROXY"));

0 commit comments

Comments
 (0)