8000 bug #37484 [HttpClient][CurlHttpClient] Fix http_version option usage… · symfony/symfony@f024382 · GitHub
[go: up one dir, main page]

Skip to content

Commit f024382

Browse files
bug #37484 [HttpClient][CurlHttpClient] Fix http_version option usage (fancyweb)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient][CurlHttpClient] Fix http_version option usage | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #37402 | License | MIT | Doc PR | - Ref #36422 If the scheme is https, we should only set http version 2.0 if the http_version is not specified. Commits ------- 2676902 [HttpClient][CurlHttpClient] Fix http_version option usage
2 parents 659699b + 2676902 commit f024382

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/HttpClient/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)
0