also support NO_PROXY
since WINDOWS can only have one case and that is usually upperasepull/6740/head
parent
edece864e7
commit
6da92e98ac
|
@ -814,10 +814,10 @@ similar use case), and need to support proxies, please provide the `CGI_HTTP_PRO
|
|||
environment variable instead. See [httpoxy.org](https://httpoxy.org/) for further
|
||||
details.
|
||||
|
||||
### no_proxy
|
||||
### no_proxy or NO_PROXY
|
||||
|
||||
If you are behind a proxy and would like to disable it for certain domains, you
|
||||
can use the `no_proxy` env var. Simply set it to a comma separated list of
|
||||
can use the `no_proxy` or `NO_PROXY` env var. Simply set it to a comma separated list of
|
||||
domains the proxy should *not* be used for.
|
||||
|
||||
The env var accepts domains, IP addresses, and IP address blocks in CIDR
|
||||
|
|
|
@ -55,8 +55,8 @@ final class StreamContextFactory
|
|||
}
|
||||
|
||||
// Remove proxy if URL matches no_proxy directive
|
||||
if (!empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
|
||||
$pattern = new NoProxyPattern($_SERVER['no_proxy']);
|
||||
if (!empty($_SERVER['NO_PROXY']) || $_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
|
||||
$pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
|
||||
if ($pattern->test($url)) {
|
||||
unset($proxy);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
|
|||
unset($_SERVER['http_proxy']);
|
||||
unset($_SERVER['HTTPS_PROXY']);
|
||||
unset($_SERVER['https_proxy']);
|
||||
unset($_SERVER['NO_PROXY']);
|
||||
unset($_SERVER['no_proxy']);
|
||||
}
|
||||
|
||||
|
@ -31,6 +32,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
|
|||
unset($_SERVER['http_proxy']);
|
||||
unset($_SERVER['HTTPS_PROXY']);
|
||||
unset($_SERVER['https_proxy']);
|
||||
unset($_SERVER['NO_PROXY']);
|
||||
unset($_SERVER['no_proxy']);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue