Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f84592a

Browse filesBrowse files
committed
bug #36422 [HttpClient] fix HTTP/2 support on non-SSL connections - CurlHttpClient only (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] fix HTTP/2 support on non-SSL connections - CurlHttpClient only | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #36419 | License | MIT | Doc PR | - Commits ------- a5b884c [HttpClient] fix HTTP/2 support on non-SSL connections - CurlHttpClient only
2 parents 280674f + a5b884c commit f84592a
Copy full SHA for f84592a

File tree

1 file changed

+4
-4
lines changed
Filter options

1 file changed

+4
-4
lines changed

‎src/Symfony/Component/HttpClient/CurlHttpClient.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/CurlHttpClient.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ public function request(string $method, string $url, array $options = []): Respo
141141
CURLOPT_CERTINFO => $options['capture_peer_cert_chain'],
142142
];
143143

144-
if (1.0 === (float) $options['http_version']) {
144+
if (\defined('CURL_VERSION_HTTP2') && (CURL_VERSION_HTTP2 & self::$curlVersion['features']) && ('https:' === $scheme || 2.0 === (float) $options['http_version'])) {
145+
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
146+
} elseif (1.0 === (float) $options['http_version']) {
145147
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;
146-
} elseif (1.1 === (float) $options['http_version'] || 'https:' !== $scheme) {
148+
} elseif (1.1 === (float) $options['http_version']) {
147149
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
148-
} elseif (\defined('CURL_VERSION_HTTP2') && CURL_VERSION_HTTP2 & self::$curlVersion['features']) {
149-
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
150150
}
151151

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.