Skip to content

Commit fa602c7

Browse files
feature symfony#59370 [HttpClient] Allow using HTTP/3 with the CurlHttpClient (MatTheCat)
This PR was merged into the 7.3 branch. Discussion ---------- [HttpClient] Allow using HTTP/3 with the `CurlHttpClient` | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | Fix symfony#58331 | License | MIT Now that PHP 8.4 is out, one can configure curl to use `CURL_HTTP_VERSION_3` (php/php-src#15350). Since curl HTTP/3 support is still experimental the `http_version` will have to be set to `3` to use this functionality, mimicking [the CLI `--http3` flag](https://curl.se/docs/http3.html#--http3) (meaning curl can fallback to HTTP/2 or HTTP/1.1). Commits ------- a7fc957 [HttpClient] Allow using HTTP/3 with the `CurlHttpClient`
2 parents 697a15e + a7fc957 commit fa602c7

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/Symfony/Component/HttpClient/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Add IPv6 support to `NativeHttpClient`
8+
* Allow using HTTP/3 with the `CurlHttpClient`
89

910
7.2
1011
---

src/Symfony/Component/HttpClient/CurlHttpClient.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ public function request(string $method, string $url, array $options = []): Respo
143143
$curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1;
144144
} elseif (\defined('CURL_VERSION_HTTP2') && (\CURL_VERSION_HTTP2 & CurlClientState::$curlVersion['features']) && ('https:' === $scheme || 2.0 === (float) $options['http_version'])) {
145145
$curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0;
146+
} elseif (\defined('CURL_VERSION_HTTP3') && (\CURL_VERSION_HTTP3 & CurlClientState::$curlVersion['features']) && 3.0 === (float) $options['http_version']) {
147+
$curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_3;
146148
}
147149

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

0 commit comments

Comments
 (0)