diff options
author | ERAMOTO Masaya <eramoto.masaya@jp.fujitsu.com> | 2016-11-25 13:26:51 +0900 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-01-13 11:18:11 +0100 |
commit | 1b57557882891285ff53c243bb4ede8b1ccac79c (patch) | |
tree | 3f4c861cd8d8380eac8d0ea0da35529ed30b44da /lib | |
parent | f30cbcac11f5a627992f0c48cff91135808fa70f (diff) |
url: Fix NO_PROXY env var to work properly with --proxy option.
The combination of --noproxy option and http_proxy env var works well
both for proxied hosts and non-proxied hosts.
However, when combining NO_PROXY env var with --proxy option,
non-proxied hosts are not reachable while proxied host is OK.
This patch allows us to access non-proxied hosts even if using NO_PROXY
env var with --proxy option.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/url.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -6079,6 +6079,7 @@ static CURLcode create_conn(struct Curl_easy *data, bool reuse; char *proxy = NULL; char *socksproxy = NULL; + char *no_proxy = NULL; bool prot_missing = FALSE; bool connections_available = TRUE; bool force_reuse = FALSE; @@ -6255,14 +6256,21 @@ static CURLcode create_conn(struct Curl_easy *data, } } - if(data->set.str[STRING_NOPROXY] && - check_noproxy(conn->host.name, data->set.str[STRING_NOPROXY])) { + no_proxy = curl_getenv("no_proxy"); + if(!no_proxy) + no_proxy = curl_getenv("NO_PROXY"); + + if(check_noproxy(conn->host.name, data->set.str[STRING_NOPROXY]) || + (!data->set.str[STRING_NOPROXY] && + check_noproxy(conn->host.name, no_proxy))) { Curl_safefree(proxy); Curl_safefree(socksproxy); } else if(!proxy && !socksproxy) proxy = detect_proxy(conn); + Curl_safefree(no_proxy); + #ifdef USE_UNIX_SOCKETS if(data->set.str[STRING_UNIX_SOCKET_PATH]) { if(proxy) { |