[HttpClient][CurlHttpClient] Fix http_version option usage

This commit is contained in:
Thomas Calvet 2020-07-03 11:26:26 +02:00 committed by Nicolas Grekas
parent 659699b9ce
commit 2676902a77
1 changed files with 3 additions and 3 deletions

View File

@ -138,12 +138,12 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
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'])) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
} elseif (1.0 === (float) $options['http_version']) {
if (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;
} elseif (\defined('CURL_VERSION_HTTP2') && (CURL_VERSION_HTTP2 & self::$curlVersion['features']) && ('https:' === $scheme || 2.0 === (float) $options['http_version'])) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
}
if (isset($options['auth_ntlm'])) {