mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
url: --noproxy option overrides NO_PROXY environment variable
Under condition using http_proxy env var, noproxy list was the combination of --noproxy option and NO_PROXY env var previously. Since this commit, --noproxy option overrides NO_PROXY environment variable even if use http_proxy env var. Closes #1140
This commit is contained in:
parent
efdbfde7ca
commit
2ac1942c72
@ -9,3 +9,7 @@ effectively disables the proxy. Each name in this list is matched as either
|
||||
a domain which contains the hostname, or the hostname itself. For example,
|
||||
local.com would match local.com, local.com:80, and www.local.com, but not
|
||||
www.notlocal.com.
|
||||
|
||||
Since 7.52.2, This option overrides the environment variables that disable
|
||||
the proxy. If there's an environment variable disabling a proxy, you can set
|
||||
noproxy list to \&"" to override it.
|
||||
|
@ -23,6 +23,16 @@ Sets the proxy server to use if no protocol-specific proxy is set.
|
||||
.IP "NO_PROXY <comma-separated list of hosts>"
|
||||
list of host names that shouldn't go through any proxy. If set to a asterisk
|
||||
\&'*' only, it matches all hosts.
|
||||
|
||||
Since 7.52.2, this environment variable disable the proxy even if specify
|
||||
--proxy option. That is
|
||||
.B NO_PROXY=direct.example.com curl -x http://proxy.example.com
|
||||
.B http://direct.example.com
|
||||
accesses the target URL directly, and
|
||||
.B NO_PROXY=direct.example.com curl -x http://proxy.example.com
|
||||
.B http://somewhere.example.com
|
||||
accesses the target URL through proxy.
|
||||
|
||||
.SH "PROXY PROTOCOL PREFIXES"
|
||||
Since curl version 7.21.7, the proxy string may be specified with a
|
||||
protocol:// prefix to specify alternative proxy protocols.
|
||||
|
@ -6252,8 +6252,7 @@ static CURLcode create_conn(struct Curl_easy *data,
|
||||
else if(!proxy && !socksproxy)
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
/* if the host is not in the noproxy list, detect proxy. */
|
||||
if(!check_noproxy(conn->host.name, no_proxy))
|
||||
proxy = detect_proxy(conn);
|
||||
proxy = detect_proxy(conn);
|
||||
#else /* !CURL_DISABLE_HTTP */
|
||||
proxy = NULL;
|
||||
#endif /* CURL_DISABLE_HTTP */
|
||||
|
@ -128,6 +128,7 @@ test1220 test1221 test1222 test1223 test1224 test1225 test1226 test1227 \
|
||||
test1228 test1229 test1230 test1231 test1232 test1233 test1234 test1235 \
|
||||
test1236 test1237 test1238 test1239 test1240 test1241 test1242 test1243 \
|
||||
test1244 test1245 test1246 test1247 test1248 test1249 test1250 test1251 \
|
||||
test1252 test1253 test1254 test1255 test1256 test1257 \
|
||||
\
|
||||
test1280 test1281 test1282 \
|
||||
\
|
||||
|
52
tests/data/test1252
Normal file
52
tests/data/test1252
Normal file
@ -0,0 +1,52 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP proxy
|
||||
NO_PROXY
|
||||
noproxy
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Length: 4
|
||||
Content-Type: text/html
|
||||
|
||||
foo
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
Under condition using --proxy, override NO_PROXY by --nproxy and access target URL directly
|
||||
</name>
|
||||
<setenv>
|
||||
NO_PROXY=example.com
|
||||
</setenv>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/1252 --proxy http://%HOSTIP:%HTTPPORT --noproxy %HOSTIP
|
||||
</command>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET /1252 HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
53
tests/data/test1253
Normal file
53
tests/data/test1253
Normal file
@ -0,0 +1,53 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP proxy
|
||||
NO_PROXY
|
||||
noproxy
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Length: 4
|
||||
Content-Type: text/html
|
||||
|
||||
foo
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
Under condition using --proxy, override NO_PROXY by --nproxy and access target URL through proxy
|
||||
</name>
|
||||
<setenv>
|
||||
NO_PROXY=example.com
|
||||
</setenv>
|
||||
<command>
|
||||
http://somewhere.example.com/1253 --proxy http://%HOSTIP:%HTTPPORT --noproxy %HOSTIP
|
||||
</command>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET http://somewhere.example.com/1253 HTTP/1.1
|
||||
Host: somewhere.example.com
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
53
tests/data/test1254
Normal file
53
tests/data/test1254
Normal file
@ -0,0 +1,53 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP proxy
|
||||
NO_PROXY
|
||||
noproxy
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Length: 4
|
||||
Content-Type: text/html
|
||||
|
||||
foo
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
Under condition using --proxy, override NO_PROXY by --nproxy and access target URL through proxy
|
||||
</name>
|
||||
<setenv>
|
||||
NO_PROXY=example.com
|
||||
</setenv>
|
||||
<command>
|
||||
http://somewhere.example.com/1254 --proxy http://%HOSTIP:%HTTPPORT --noproxy ""
|
||||
</command>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET http://somewhere.example.com/1254 HTTP/1.1
|
||||
Host: somewhere.example.com
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
53
tests/data/test1255
Normal file
53
tests/data/test1255
Normal file
@ -0,0 +1,53 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP proxy
|
||||
NO_PROXY
|
||||
noproxy
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Length: 4
|
||||
Content-Type: text/html
|
||||
|
||||
foo
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
Under condition using http_proxy, override NO_PROXY by --nproxy and access target URL directly
|
||||
</name>
|
||||
<setenv>
|
||||
http_proxy=http://%HOSTIP:%HTTPPORT
|
||||
NO_PROXY=example.com
|
||||
</setenv>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/1255 --noproxy %HOSTIP
|
||||
</command>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET /1255 HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
54
tests/data/test1256
Normal file
54
tests/data/test1256
Normal file
@ -0,0 +1,54 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP proxy
|
||||
NO_PROXY
|
||||
noproxy
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Length: 4
|
||||
Content-Type: text/html
|
||||
|
||||
foo
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
Under condition using http_proxy, override NO_PROXY by --nproxy and access target URL through proxy
|
||||
</name>
|
||||
<setenv>
|
||||
http_proxy=http://%HOSTIP:%HTTPPORT
|
||||
NO_PROXY=example.com
|
||||
</setenv>
|
||||
<command>
|
||||
http://somewhere.example.com/1256 --noproxy %HOSTIP
|
||||
</command>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET http://somewhere.example.com/1256 HTTP/1.1
|
||||
Host: somewhere.example.com
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
54
tests/data/test1257
Normal file
54
tests/data/test1257
Normal file
@ -0,0 +1,54 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP proxy
|
||||
NO_PROXY
|
||||
noproxy
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Length: 4
|
||||
Content-Type: text/html
|
||||
|
||||
foo
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
Under condition using http_proxy, override NO_PROXY by --nproxy and access target URL through proxy
|
||||
</name>
|
||||
<setenv>
|
||||
http_proxy=http://%HOSTIP:%HTTPPORT
|
||||
NO_PROXY=example.com
|
||||
</setenv>
|
||||
<command>
|
||||
http://somewhere.example.com/1257 --noproxy ""
|
||||
</command>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET http://somewhere.example.com/1257 HTTP/1.1
|
||||
Host: somewhere.example.com
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
Loading…
Reference in New Issue
Block a user