Auto-disable misbehaving curl downloader on php 5, refs #9002
parent
51685580c7
commit
472f78bff1
|
@ -80,7 +80,27 @@ class HttpDownloader
|
|||
list($job) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => false), true);
|
||||
$this->wait($job['id']);
|
||||
|
||||
return $this->getResponse($job['id']);
|
||||
$response = $this->getResponse($job['id']);
|
||||
|
||||
// check for failed curl response (empty body but successful looking response)
|
||||
if (
|
||||
$this->curl
|
||||
&& PHP_VERSION_ID < 70000
|
||||
&& $response->getBody() === null
|
||||
&& $response->getStatusCode() === 200
|
||||
&& $response->getHeader('content-length') !== '0'
|
||||
) {
|
||||
$this->io->writeError('<warning>cURL downloader failed to return a response, disabling it and proceeding in slow mode.</warning>');
|
||||
|
||||
$this->curl = null;
|
||||
|
||||
list($job) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => false), true);
|
||||
$this->wait($job['id']);
|
||||
|
||||
$response = $this->getResponse($job['id']);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function add($url, $options = array())
|
||||
|
|
Loading…
Reference in New Issue