1
0
Fork 0

Workaround curl bug in 8.7.0/8.7.1, fixes #11913

pull/11963/head
Jordi Boggiano 2024-04-28 17:09:38 +02:00
parent 0d5549f503
commit a7c6125ee4
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 7 additions and 1 deletions

View File

@ -199,7 +199,7 @@ EOT
} }
$io->write('OpenSSL version: ' . (defined('OPENSSL_VERSION_TEXT') ? '<comment>'.OPENSSL_VERSION_TEXT.'</comment>' : '<error>missing</error>')); $io->write('OpenSSL version: ' . (defined('OPENSSL_VERSION_TEXT') ? '<comment>'.OPENSSL_VERSION_TEXT.'</comment>' : '<error>missing</error>'));
$io->write('cURL version: ' . $this->getCurlVersion()); $io->write('curl version: ' . $this->getCurlVersion());
$finder = new ExecutableFinder; $finder = new ExecutableFinder;
$hasSystemUnzip = (bool) $finder->find('unzip'); $hasSystemUnzip = (bool) $finder->find('unzip');

View File

@ -221,6 +221,12 @@ class CurlDownloader
curl_setopt($curlHandle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); curl_setopt($curlHandle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
} }
// curl 8.7.0 - 8.7.1 has a bug whereas automatic accept-encoding header results in an error when reading the response
// https://github.com/composer/composer/issues/11913
if (in_array($version['version'], ['8.7.0', '8.7.1'], true) && \defined('CURL_VERSION_LIBZ') && (CURL_VERSION_LIBZ & $features)) {
curl_setopt($curlHandle, CURLOPT_ENCODING, "gzip");
}
$options['http']['header'] = $this->authHelper->addAuthenticationHeader($options['http']['header'], $origin, $url); $options['http']['header'] = $this->authHelper->addAuthenticationHeader($options['http']['header'], $origin, $url);
$options = StreamContextFactory::initOptions($url, $options, true); $options = StreamContextFactory::initOptions($url, $options, true);