Skip to content

Commit aa7e3c2

Browse files
fancywebnicolas-grekas
authored andcommitted
[HttpClient][CurlHttpClient] Fix http_version option usage
1 parent c96c1df commit aa7e3c2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

CurlHttpClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ public function request(string $method, string $url, array $options = []): Respo
138138
CURLOPT_CERTINFO => $options['capture_peer_cert_chain'],
139139
];
140140

141-
if (\defined('CURL_VERSION_HTTP2') && (CURL_VERSION_HTTP2 & self::$curlVersion['features']) && ('https:' === $scheme || 2.0 === (float) $options['http_version'])) {
142-
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
143-
} elseif (1.0 === (float) $options['http_version']) {
141+
if (1.0 === (float) $options['http_version']) {
144142
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;
145143
} elseif (1.1 === (float) $options['http_version']) {
146144
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
145+
} elseif (\defined('CURL_VERSION_HTTP2') && (CURL_VERSION_HTTP2 & self::$curlVersion['features']) && ('https:' === $scheme || 2.0 === (float) $options['http_version'])) {
146+
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
147147
}
148148

149149
if (isset($options['auth_ntlm'])) {

0 commit comments

Comments
 (0)