Skip to content

Commit

Permalink
[HttpClient][CurlHttpClient] Fix http_version option usage
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyweb committed Jul 3, 2020
1 parent 659699b commit 6611b0b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Symfony/Component/HttpClient/CurlHttpClient.php
Expand Up @@ -138,12 +138,12 @@ public function request(string $method, string $url, array $options = []): Respo
CURLOPT_CERTINFO => $options['capture_peer_cert_chain'],
];

if (\defined('CURL_VERSION_HTTP2') && (CURL_VERSION_HTTP2 & self::$curlVersion['features']) && ('https:' === $scheme || 2.0 === (float) $options['http_version'])) {
if (\defined('CURL_VERSION_HTTP2') && (CURL_VERSION_HTTP2 & self::$curlVersion['features']) && (('https:' === $scheme && null === $options['http_version']) || 2.0 === (float) $options['http_version'])) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
} elseif (('http:' === $scheme && null === $options['http_version']) || 1.1 === (float) $options['http_version']) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
} elseif (1.0 === (float) $options['http_version']) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;
} elseif (1.1 === (float) $options['http_version']) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
}

if (isset($options['auth_ntlm'])) {
Expand Down

0 comments on commit 6611b0b

Please sign in to comment.