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'].'~';