Repository navigation
Conversation
The http stream wrapper always sent the CONNECT request used to tunnel HTTPS through a proxy as HTTP/1.0, ignoring the "protocol_version" context option. Proxies that only accept HTTP/1.1 reject it with 426 Upgrade Required. Use the "protocol_version" context option for the CONNECT request as well, and send the Host header required by HTTP/1.1 in that case. Without the option, CONNECT still uses HTTP/1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I wonder whether deprecating Developers could use |
|
Quoted below: written with Claude, an LLM, as CONTRIBUTING.md asks us to mark. The builds and test runs behind it are on my machine; the commands to repeat them are under the fold.
|
Closes GH-8832
The http stream wrapper always sends the
CONNECTrequest used to tunnel HTTPS through a proxy as HTTP/1.0, regardless of theprotocol_versioncontext option. Proxies that only accept HTTP/1.1 (e.g. Envoy, as in the issue) answer with426 Upgrade Required, makingfile_get_contents()over HTTPS through such a proxy impossible.This makes the
CONNECTrequest honor the existingprotocol_versioncontext option, and sends theHostheader (the target authority) that HTTP/1.1 requires:When the option is not set, nothing changes:
CONNECTis still sent as HTTP/1.0, withoutHost.Notes:
protocol_versionrather than adding a new option such asproxy_protocol_version, since users setting it most likely expect it to apply to the whole exchange, and it keeps the API surface unchanged. Happy to switch if a separate option is preferred.426 Upgrade Requiredautomatically (as discussed in the issue) does not help here, since the proxy in the report closes the connection and sends noUpgradeheader.zval_get_double()+%.1F), so both lines always agree.http_proxy_ssl_connect_0x.phpttests; the HTTP/1.0 default is already covered byhttp_proxy_ssl_connect_01.phpt. Added an UPGRADING entry under "Changed Functions".🤖 Generated with Claude Code