summaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-04-10 21:30:28 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-04-11 10:56:03 +0200
commit85eea2fb3875e5e031caef70127d7632632f6ba5 (patch)
treec92c88848a71a2a04e0582e8afa62e59c2527435 /lib/url.c
parent249a7c9dace583d6680044d2bd3064d1e9970c8c (diff)
downloadcurl-85eea2fb3875e5e031caef70127d7632632f6ba5.tar.gz
proxy: show getenv proxy use in verbose output
... to aid debugging etc as it sometimes isn't immediately obvious why curl uses or doesn't use a proxy. Inspired by #2477 Closes #2480
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/lib/url.c b/lib/url.c
index feb1fa70f..8c9c69141 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2662,13 +2662,19 @@ static char *detect_proxy(struct connectdata *conn)
prox = curl_getenv(proxy_env);
}
- if(prox)
+ envp = proxy_env;
+ if(prox) {
proxy = prox; /* use this */
+ }
else {
- proxy = curl_getenv("all_proxy"); /* default proxy to use */
- if(!proxy)
- proxy = curl_getenv("ALL_PROXY");
+ envp = (char *)"all_proxy";
+ proxy = curl_getenv(envp); /* default proxy to use */
+ if(!proxy) {
+ envp = (char *)"ALL_PROXY";
+ proxy = curl_getenv(envp);
+ }
}
+ infof(conn->data, "Uses proxy env variable %s == '%s'\n", envp, proxy);
return proxy;
}
@@ -2953,9 +2959,15 @@ static CURLcode create_conn_helper_init_proxy(struct connectdata *conn)
}
if(!data->set.str[STRING_NOPROXY]) {
- no_proxy = curl_getenv("no_proxy");
- if(!no_proxy)
- no_proxy = curl_getenv("NO_PROXY");
+ const char *p = "no_proxy";
+ no_proxy = curl_getenv(p);
+ if(!no_proxy) {
+ p = "NO_PROXY";
+ no_proxy = curl_getenv(p);
+ }
+ if(no_proxy) {
+ infof(conn->data, "Uses proxy env variable %s == '%s'\n", p, no_proxy);
+ }
}
if(check_noproxy(conn->host.name, data->set.str[STRING_NOPROXY] ?