diff options
author | Sergey Ryazanov <ryazanov.s.a@gmail.com> | 2017-04-11 23:22:19 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-13 15:51:33 -0700 |
commit | ae51d91105981888f58ad21825b4ef0c540032e3 (patch) | |
tree | 9282bc228e7f12605e4a5a9574f2d502d5b201b0 | |
parent | 57415089bd33575bcb7e134ddb2e1eacee3dfaca (diff) | |
download | git-sr/http-proxy-configuration-fix.tar.gz |
http: fix the silent ignoring of proxy misconfiguraionsr/http-proxy-configuration-fix
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 372370f167 ("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>
-rw-r--r-- | http.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -867,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")); |