-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] Add support for HTTP/3 #58331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you don't specify the |
That doesn't seem to be the case from my findings. Or at least, it won't prefer HTTP/3 over HTTP/2. On cli: $ curl -I https://www.denotenshop.nl/
HTTP/2 200
$ curl --http3 -I https://www.denotenshop.nl/
HTTP/3 200 So it's not the default one even if the website supports it. Same thing in PHP: use Symfony\Component\HttpClient\CurlHttpClient;
$httpClient = new CurlHttpClient();
$httpResponse = $httpClient->request('GET', 'https://www.denotenshop.nl/');
$httpResponse->getHeaders();
print_r($httpResponse->getInfo()); Results in following output:
Changing versions in the options works, but not for version '3.0' because there is no support yet in the http client: $httpResponse = $httpClient->request('GET', 'https://www.denotenshop.nl/', ['http_version' => '1.1']);
// => output: HTTP/1.1 200 OK
$httpResponse = $httpClient->request('GET', 'https://www.denotenshop.nl/', ['http_version' => '2.0']);
// => output: HTTP/2 200
$httpResponse = $httpClient->request('GET', 'https://www.denotenshop.nl/', ['http_version' => '3.0']);
// => output: HTTP/2 200 And yes, my curl in php is seen as being compatible with HTTP/3:
|
Or maybe we should wait with implementing it until curl no longer considers the feature to be experimental, maybe they will change the default/fallback logic later on when they consider the implementation stable... Update: found this thread, so probably we'll have to wait until PHP 8.4 is out. |
Description
HTTP/3 is the successor of HTTP/2 and is slowly being used more and more on the web.
It would be nice if HttpClient could support it, currently it only supports up to version 2 in the curl client as far as I can see: https://github.com/symfony/http-client/blob/2af7c5a46eb26bd81a35617e3b198abecd994066/CurlHttpClient.php#L140-L146
Ideally it should try to use HTTP/3 by default if
http_version
is not provided in the config and when your system supports it.Thanks!
Example
No response
The text was updated successfully, but these errors were encountered: