[HttpClient] disable debug log with curl 7.64.0

This commit is contained in:
Nicolas Grekas 2020-03-12 15:38:01 +01:00
parent d0b74453de
commit d4cde31940
2 changed files with 8 additions and 4 deletions

View File

@ -308,7 +308,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
}
}
return $pushedResponse ?? new CurlResponse($this->multi, $ch, $options, $this->logger, $method, self::createRedirectResolver($options, $host));
return $pushedResponse ?? new CurlResponse($this->multi, $ch, $options, $this->logger, $method, self::createRedirectResolver($options, $host), self::$curlVersion['version_number']);
}
/**

View File

@ -37,15 +37,19 @@ final class CurlResponse implements ResponseInterface
/**
* @internal
*/
public function __construct(CurlClientState $multi, $ch, array $options = null, LoggerInterface $logger = null, string $method = 'GET', callable $resolveRedirect = null)
public function __construct(CurlClientState $multi, $ch, array $options = null, LoggerInterface $logger = null, string $method = 'GET', callable $resolveRedirect = null, int $curlVersion = null)
{
$this->multi = $multi;
if (\is_resource($ch)) {
$this->handle = $ch;
$this->debugBuffer = fopen('php://temp', 'w+');
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, $this->debugBuffer);
if (0x074000 === $curlVersion) {
fwrite($this->debugBuffer, 'Due to a bug in curl 7.64.0, the debug log is disabled; use another version to work around the issue.');
} else {
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, $this->debugBuffer);
}
} else {
$this->info['url'] = $ch;
$ch = $this->handle;