Proxy handling docs and tweaks (#9735)
parent
07f59a9162
commit
4f47a4c667
|
@ -183,7 +183,6 @@ class CurlDownloader
|
||||||
}
|
}
|
||||||
|
|
||||||
$options['http']['header'] = $this->authHelper->addAuthenticationHeader($options['http']['header'], $origin, $url);
|
$options['http']['header'] = $this->authHelper->addAuthenticationHeader($options['http']['header'], $origin, $url);
|
||||||
// Merge in headers - we don't get any proxy values
|
|
||||||
$options = StreamContextFactory::initOptions($url, $options, true);
|
$options = StreamContextFactory::initOptions($url, $options, true);
|
||||||
|
|
||||||
foreach (self::$options as $type => $curlOptions) {
|
foreach (self::$options as $type => $curlOptions) {
|
||||||
|
|
|
@ -131,12 +131,14 @@ class ProxyHelper
|
||||||
$error = sprintf('malformed %s url', $envName);
|
$error = sprintf('malformed %s url', $envName);
|
||||||
$proxy = parse_url($proxyUrl);
|
$proxy = parse_url($proxyUrl);
|
||||||
|
|
||||||
|
// We need parse_url to have identified a host
|
||||||
if (!isset($proxy['host'])) {
|
if (!isset($proxy['host'])) {
|
||||||
throw new \RuntimeException($error);
|
throw new \RuntimeException($error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$proxyUrl = self::formatParsedUrl($proxy, true);
|
$proxyUrl = self::formatParsedUrl($proxy, true);
|
||||||
|
|
||||||
|
// We need a port because streams and curl use different defaults
|
||||||
if (!parse_url($proxyUrl, PHP_URL_PORT)) {
|
if (!parse_url($proxyUrl, PHP_URL_PORT)) {
|
||||||
throw new \RuntimeException($error);
|
throw new \RuntimeException($error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ class RemoteFilesystem
|
||||||
|
|
||||||
$ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
|
$ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
|
||||||
|
|
||||||
$proxy = ProxyManager::getInstance()->getProxyForRequest($fileUrl);
|
$proxy = $this->proxyManager->getProxyForRequest($fileUrl);
|
||||||
$usingProxy = $proxy->getFormattedUrl(' using proxy (%s)');
|
$usingProxy = $proxy->getFormattedUrl(' using proxy (%s)');
|
||||||
$this->io->writeError((strpos($origFileUrl, 'http') === 0 ? 'Downloading ' : 'Reading ') . Url::sanitize($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
|
$this->io->writeError((strpos($origFileUrl, 'http') === 0 ? 'Downloading ' : 'Reading ') . Url::sanitize($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
|
||||||
unset($origFileUrl, $proxy, $usingProxy);
|
unset($origFileUrl, $proxy, $usingProxy);
|
||||||
|
|
Loading…
Reference in New Issue