1
0
Fork 0

Proxy handling docs and tweaks (#9735)

pull/9734/head
John Stevenson 2021-03-05 19:05:36 +00:00 committed by GitHub
parent 07f59a9162
commit 4f47a4c667
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -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) {

View File

@ -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);
} }

View File

@ -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);