Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpClient] Curl client always uses HTTP 2.0 even when specifying otherwise #37402

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

Closed
relm opened this issue Jun 23, 2020 · 0 comments
Closed

Comments

@relm
Copy link

relm commented Jun 23, 2020

Symfony version(s) affected: 4.4.10

Description
I'm experiencing an issue with random TransportException errors (seems to be server side related) so I'm attempting to use HTTP 1.1 instead of 2.0. The problem is, HttpClient always seems to use 2.0 even when specifying otherwise.

I have the following in framework.yaml:

http_client:
    max_host_connections: 1
    default_options:
        http_version: '1.1'

I also tried passing http_version => '1.1' to the $options parameter of request, still uses 2.0. Is there something I'm missing?

If I disable http2 on the httpd side (nginx) then it uses 1.1 as you'd expect. I should still be able to use 1.1 if 2.0 is enabled server side though right?

Example output with $r->getInfo('debug') from my logs:

  "details" => """
    * Found bundle for host api.test.net: 0x55d1dc5cfc20 [can multiplex]\n
    * Re-using existing connection! (#0) with host api.test.net\n
    * Connected to api.test.net (127.0.0.1) port 443 (#0)\n
    * Using Stream ID: 13 (easy handle 0x55d1dc57cc60)\n
    > GET /public/status HTTP/2\r\n
    Host: api.test.net\r\n
    accept: */*\r\n
    user-agent: Symfony HttpClient/Curl\r\n
    accept-encoding: gzip\r\n
    \r\n
    < HTTP/2 200 \r\n
    < server: nginx/1.17.10 (Ubuntu)\r\n
    < content-type: application/json\r\n
    < cache-control: no-cache, private\r\n
    < date: Tue, 23 Jun 2020 22:53:59 GMT\r\n
    < x-debug-token: cb2ac3\r\n
    < x-debug-token-link: https://api.test.net/_profiler/cb2ac3\r\n
    < x-robots-tag: noindex\r\n
    < x-content-type-options: nosniff\r\n
    < strict-transport-security: max-age=15768000\r\n
    < \r\n
    * Connection #0 to host api.test.net left intact\n
    """,
  "options" => [
    "http_version" => "1.1"
  ],
  "response" => "{"success":true,"status":"E1"}"
@relm relm added the Bug label Jun 23, 2020
nicolas-grekas added a commit that referenced this issue Jul 3, 2020
… (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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants