if ($e instanceof TransportException && $response) {
if ($e instanceof TransportException && $response) {
$e->setResponse($response->getBody());
$e->setResponse($response->getBody());
}
}
if ($e instanceof TransportException && $progress) {
$e->setResponseInfo($progress);
}
if (is_resource($job['headerHandle'])) {
if (is_resource($job['headerHandle'])) {
fclose($job['headerHandle']);
fclose($job['headerHandle']);
@ -417,7 +418,7 @@ class CurlDownloader
}
}
}
}
private function handleRedirect(array $job, Response $response, array $responseInfo)
private function handleRedirect(array $job, Response $response)
{
{
if ($locationHeader = $response->getHeader('location')) {
if ($locationHeader = $response->getHeader('location')) {
if (parse_url($locationHeader, PHP_URL_SCHEME)) {
if (parse_url($locationHeader, PHP_URL_SCHEME)) {
@ -445,12 +446,10 @@ class CurlDownloader
return $targetUrl;
return $targetUrl;
}
}
$exception = new TransportException('The "'.$job['url'].'" file could not be downloaded, got redirect without Location ('.$response->getStatusMessage().')');
throw new TransportException('The "'.$job['url'].'" file could not be downloaded, got redirect without Location ('.$response->getStatusMessage().')');
$exception->setResponseInfo($responseInfo);
throw $exception;
}
}
private function isAuthenticatedRetryNeeded(array $job, Response $response, array $responseInfo)
private function isAuthenticatedRetryNeeded(array $job, Response $response)
{
{
if (in_array($response->getStatusCode(), array(401, 403)) && $job['attributes']['retryAuthFailure']) {
if (in_array($response->getStatusCode(), array(401, 403)) && $job['attributes']['retryAuthFailure']) {