From e8a3a330232cf53e1b4bbbb3a8ba8947122e575d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 25 Nov 2020 12:40:05 +0100 Subject: [PATCH] Also output headers --- src/Composer/Util/Http/CurlDownloader.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Composer/Util/Http/CurlDownloader.php b/src/Composer/Util/Http/CurlDownloader.php index 4d79582d6..5345f5ce3 100644 --- a/src/Composer/Util/Http/CurlDownloader.php +++ b/src/Composer/Util/Http/CurlDownloader.php @@ -305,15 +305,15 @@ class CurlDownloader } throw new TransportException('curl error '.$errno.' while downloading '.Url::sanitize($progress['url']).': '.$error); } - if ($progress['http_code'] === 0) { - throw new \LogicException('Received unexpected http status code 0 without error for '.Url::sanitize($progress['url']).': '.var_export($progress, true)); - } - $statusCode = $progress['http_code']; rewind($job['headerHandle']); $headers = explode("\r\n", rtrim(stream_get_contents($job['headerHandle']))); fclose($job['headerHandle']); + if ($statusCode === 0) { + throw new \LogicException('Received unexpected http status code 0 without error for '.Url::sanitize($progress['url']).': headers '.var_export($headers, true).' curl info '.var_export($progress, true)); + } + // prepare response object if ($job['filename']) { $contents = $job['filename'].'~';