1
0
Fork 0

Also output headers

pull/9519/head
Jordi Boggiano 2020-11-25 12:40:05 +01:00
parent 8030fbc4ae
commit e8a3a33023
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 4 additions and 4 deletions

View File

@ -305,15 +305,15 @@ class CurlDownloader
} }
throw new TransportException('curl error '.$errno.' while downloading '.Url::sanitize($progress['url']).': '.$error); 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']; $statusCode = $progress['http_code'];
rewind($job['headerHandle']); rewind($job['headerHandle']);
$headers = explode("\r\n", rtrim(stream_get_contents($job['headerHandle']))); $headers = explode("\r\n", rtrim(stream_get_contents($job['headerHandle'])));
fclose($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 // prepare response object
if ($job['filename']) { if ($job['filename']) {
$contents = $job['filename'].'~'; $contents = $job['filename'].'~';