Skip to content

[Http-Client] "Failure when receiving data from the peer" / "Proxy CONNECT aborted" with v4.4.38+, OK with 4.4.37 #47973

Closed
@cpetit-sigma-fr

Description

@cpetit-sigma-fr

Symfony version(s) affected

4.4.38+

Description

With http-client:4.4.38 and above (up to http-client:4.4.46), I don't manage to connect to an external API through our proxy:

$ php bin/console myapp:test-xxx
^ """
* About to connect() to proxy proxy.xxx.yyy.zzz port 8080 (#0)\n
*   Trying 1.2.3.4...\n
* TCP_NODELAY set\n
* Connected to proxy.xxx.yyy.zzz (1.2.3.4) port 8080 (#0)\n
* Establish HTTP proxy tunnel to api.provider.com:443\n
> CONNECT api.provider.com:443 HTTP/1.1\r\n
Host: api.provider.com:443\r\n
Proxy-Connection: Keep-Alive\r\n
Content-Type: application/json\r\n
Accept: application/json\r\n
Content-Length: 75\r\n
User-Agent: Symfony HttpClient/Curl\r\n
Accept-Encoding: gzip\r\n
\r\n
* Proxy CONNECT aborted\n
* Connection #0 to host proxy.xxx.yyy.zzz left intact\n
"""
14:10:48 ERROR     [app] XXX: post('') Failure when receiving data from the peer for "https://api.provider.com/". ["exception" => Symfony\Component\HttpClient\Exception\TransportException^ { …}]


 [ERROR] XXX : Failure when receiving data from the peer for
         "https://api.provider.com/".

How to reproduce

Sorry, I didn't write any reproduction script, my use of CurlHttpClient seems to be completely standard and I manage to use other APIs within my application, the only thing that changes is HttpClient version.

Possible Solution

If i downgrade to http-client:4.4.37, it does work:

$ php bin/console myapp:test-xxx

 [OK] XXX : OK

If i use directly curl_init(), curl_setopt() and curl_exec(), it does work, too.

If don't see what introduced this behaviour between the two releases looking at symfony/http-client@v4.4.37...v4.4.38.

Additional Context

NB: seems the same as #46499, I hope I can help resolving this regression.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions