Fix CS and wording, remove lowercased env var, add env var to docs
parent
aaa4571989
commit
8c197d2325
|
@ -404,6 +404,12 @@ some tools like git or curl will only use the lower-cased `http_proxy` version.
|
||||||
Alternatively you can also define the git proxy using
|
Alternatively you can also define the git proxy using
|
||||||
`git config --global http.proxy <proxy url>`.
|
`git config --global http.proxy <proxy url>`.
|
||||||
|
|
||||||
|
### HTTP_PROXY_REQUEST_FULLURI
|
||||||
|
|
||||||
|
If you use a proxy but it does not support the request_fulluri flag, then you
|
||||||
|
should set this env var to `false` or `0` to prevent composer from setting the
|
||||||
|
request_fulluri option.
|
||||||
|
|
||||||
### COMPOSER_HOME
|
### COMPOSER_HOME
|
||||||
|
|
||||||
The `COMPOSER_HOME` var allows you to change the composer home directory. This
|
The `COMPOSER_HOME` var allows you to change the composer home directory. This
|
||||||
|
|
|
@ -56,7 +56,7 @@ EOT
|
||||||
if (!empty($opts['http']['proxy'])) {
|
if (!empty($opts['http']['proxy'])) {
|
||||||
$output->write('Checking HTTP proxy: ');
|
$output->write('Checking HTTP proxy: ');
|
||||||
$this->outputResult($output, $this->checkHttpProxy());
|
$this->outputResult($output, $this->checkHttpProxy());
|
||||||
$output->write('Checking HTTPS proxy fullrequest_uri: ');
|
$output->write('Checking HTTPS proxy support for request_fulluri: ');
|
||||||
$this->outputResult($output, $this->checkHttpsProxyFullUriRequestParam());
|
$this->outputResult($output, $this->checkHttpsProxyFullUriRequestParam());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,31 +145,29 @@ EOT
|
||||||
* Due to various proxy servers configurations, some servers cant handle non-standard HTTP "http_proxy_request_fulluri" parameter,
|
* Due to various proxy servers configurations, some servers cant handle non-standard HTTP "http_proxy_request_fulluri" parameter,
|
||||||
* and will return error 500/501 (as not implemented), see discussion @ https://github.com/composer/composer/pull/1825.
|
* and will return error 500/501 (as not implemented), see discussion @ https://github.com/composer/composer/pull/1825.
|
||||||
* This method will test, if you need to disable this parameter via setting extra environment variable in your system.
|
* This method will test, if you need to disable this parameter via setting extra environment variable in your system.
|
||||||
|
*
|
||||||
* @return bool|string
|
* @return bool|string
|
||||||
*/
|
*/
|
||||||
private function checkHttpsProxyFullUriRequestParam()
|
private function checkHttpsProxyFullUriRequestParam()
|
||||||
{
|
{
|
||||||
$protocol = 'https';
|
$url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0 ';
|
||||||
$resultMessage = true;
|
try {
|
||||||
|
$rfcResult = $this->rfs->getContents('api.github.com', $url, false);
|
||||||
/* i've found no better file to test with so far :( */
|
} catch (TransportException $e) {
|
||||||
$filePath = '://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0 ';
|
if (!extension_loaded('openssl')) {
|
||||||
try
|
return 'You need the openssl extension installed for this check';
|
||||||
{
|
|
||||||
$rfcResult = $this->rfs->getContents('api.github.com', $protocol . $filePath, false);
|
|
||||||
}
|
|
||||||
catch (TransportException $e)
|
|
||||||
{
|
|
||||||
if (!extension_loaded('openssl'))
|
|
||||||
{
|
|
||||||
return "Sorry, but you need openssl extension installed for this check - please enable/recompile\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->rfs->getContents('api.github.com', $protocol . $filePath, false, array('http' => array('request_fulluri' => false)));
|
try {
|
||||||
$resultMessage = "Seems there is a problem with your proxy server, try setting value of your environment variable \"http_proxy_request_fulluri\" to false, and run diagnostics again\n";
|
$this->rfs->getContents('api.github.com', $url, false, array('http' => array('request_fulluri' => false)));
|
||||||
|
} catch (TransportException $e) {
|
||||||
|
return 'Unable to assert the situation, maybe github is down ('.$e->getMessage().')';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $resultMessage;
|
return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" environment variable to "false"';
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkGithubOauth($domain, $token)
|
private function checkGithubOauth($domain, $token)
|
||||||
|
|
|
@ -62,13 +62,11 @@ final class StreamContextFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
$options['http']['proxy'] = $proxyURL;
|
$options['http']['proxy'] = $proxyURL;
|
||||||
$options['http']['request_fulluri'] = true;
|
|
||||||
|
|
||||||
if ( strtolower( getenv('http_proxy_request_fulluri') ) == 'false' ||
|
// enabled request_fulluri unless it is explicitly disabled
|
||||||
strtolower( getenv('HTTP_PROXY_REQUEST_FULLURI') ) == 'false'
|
$reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
|
||||||
)
|
if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
|
||||||
{
|
$options['http']['request_fulluri'] = true;
|
||||||
$options['http']['request_fulluri'] = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($proxy['user'])) {
|
if (isset($proxy['user'])) {
|
||||||
|
|
Loading…
Reference in New Issue