Skip to content

Commit

Permalink
[HttpClient] disable debug log with curl 7.64.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Mar 12, 2020
1 parent d0b7445 commit 96c6b0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpClient/CurlHttpClient.php
Expand Up @@ -308,7 +308,7 @@ public function request(string $method, string $url, array $options = []): Respo
}
}

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']);
}

/**
Expand Down
10 changes: 7 additions & 3 deletions src/Symfony/Component/HttpClient/Response/CurlResponse.php
Expand Up @@ -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('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;
Expand Down

0 comments on commit 96c6b0d

Please sign in to comment.