Notes on HTTP_PROXY env var
parent
31ed0c1fb0
commit
81fdd790f2
|
@ -179,10 +179,15 @@ directory to something other than `vendor/bin`.
|
|||
This env var controls the time composer waits for commands (such as git
|
||||
commands) to finish executing. The default value is 60 seconds.
|
||||
|
||||
### HTTP_PROXY
|
||||
### http_proxy or HTTP_PROXY
|
||||
|
||||
If you are using composer from behind an HTTP proxy, you can use the standard
|
||||
`HTTP_PROXY` or `http_proxy` env vars. Simply set it to the URL of your proxy.
|
||||
`http_proxy` or `HTTP_PROXY` env vars. Simply set it to the URL of your proxy.
|
||||
Many operating systems already set this variable for you.
|
||||
|
||||
Using `http_proxy` (lowercased) or even defining both might be preferrable since
|
||||
some tools like git or curl will only use the lower-cased `http_proxy` version.
|
||||
Alternatively you can also define the git proxy using
|
||||
`git config --global http.proxy <proxy url>`.
|
||||
|
||||
← [Libraries](02-libraries.md) | [Schema](04-schema.md) →
|
|
@ -34,15 +34,15 @@ final class StreamContextFactory
|
|||
// Handle system proxy
|
||||
if (isset($_SERVER['HTTP_PROXY']) || isset($_SERVER['http_proxy'])) {
|
||||
// Some systems seem to rely on a lowercased version instead...
|
||||
$proxy = isset($_SERVER['HTTP_PROXY']) ? $_SERVER['HTTP_PROXY'] : $_SERVER['http_proxy'];
|
||||
|
||||
$proxy = isset($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY'];
|
||||
|
||||
// http(s):// is not supported in proxy
|
||||
$proxy = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxy);
|
||||
|
||||
if (0 === strpos($proxy, 'ssl:') && !extension_loaded('openssl')) {
|
||||
throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
|
||||
}
|
||||
|
||||
|
||||
$options['http'] = array(
|
||||
'proxy' => $proxy,
|
||||
'request_fulluri' => true,
|
||||
|
|
Loading…
Reference in New Issue