1
0
Fork 0

Fix logic (again)

pull/9334/head
johnstevenson 2020-10-25 12:59:01 +00:00
parent 2a913c7a68
commit c99e19db64
2 changed files with 19 additions and 17 deletions

View File

@ -13,6 +13,8 @@
namespace Composer\Exception;
/**
* Specific exception for Composer\Util\HttpDownloader creation.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class NoSslException extends \RuntimeException

View File

@ -75,6 +75,7 @@ final class StreamContextFactory
// Add stream proxy options if there is a proxy
if (!$forCurl) {
$proxy = ProxyManager::getInstance()->getProxyForRequest($url);
if ($proxyOptions = $proxy->getContextOptions()) {
$isHttpsRequest = 0 === strpos($url, 'https://');
if ($proxy->isSecure()) {
@ -88,8 +89,6 @@ final class StreamContextFactory
throw new TransportException('You must enable the openssl extension to make https requests through a proxy.');
}
$proxyOptions = $proxy->getContextOptions();
// Header will be a Proxy-Authorization string or not set
if (isset($proxyOptions['http']['header'])) {
$options['http']['header'][] = $proxyOptions['http']['header'];
@ -97,6 +96,7 @@ final class StreamContextFactory
}
$options = array_replace_recursive($options, $proxyOptions);
}
}
if (defined('HHVM_VERSION')) {
$phpVersion = 'HHVM ' . HHVM_VERSION;