1
0
Fork 0

Fix degraded mode usage on packagist, fixes #5350

pull/5360/head
Jordi Boggiano 2016-05-17 14:08:14 +01:00
parent 3a6a3655b0
commit 143db7a9f5
1 changed files with 2 additions and 1 deletions

View File

@ -249,6 +249,7 @@ class RemoteFilesystem
if ($this->degradedMode && substr($fileUrl, 0, 21) === 'http://packagist.org/') { if ($this->degradedMode && substr($fileUrl, 0, 21) === 'http://packagist.org/') {
// access packagist using the resolved IPv4 instead of the hostname to force IPv4 protocol // access packagist using the resolved IPv4 instead of the hostname to force IPv4 protocol
$fileUrl = 'http://' . gethostbyname('packagist.org') . substr($fileUrl, 20); $fileUrl = 'http://' . gethostbyname('packagist.org') . substr($fileUrl, 20);
$degradedPackagist = true;
} }
$ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet'))); $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
@ -259,7 +260,7 @@ class RemoteFilesystem
unset($origFileUrl, $actualContextOptions); unset($origFileUrl, $actualContextOptions);
// Check for secure HTTP, but allow insecure Packagist calls to $hashed providers as file integrity is verified with sha256 // Check for secure HTTP, but allow insecure Packagist calls to $hashed providers as file integrity is verified with sha256
if ((substr($fileUrl, 0, 23) !== 'http://packagist.org/p/' || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && $this->config) { if ((substr($fileUrl, 0, 23) !== 'http://packagist.org/p/' || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
$this->config->prohibitUrlByConfig($fileUrl, $this->io); $this->config->prohibitUrlByConfig($fileUrl, $this->io);
} }