Support "protocol_version" stream context option for proxy connections
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
Hello. We have protocol_version option for talking with remote host using specified HTTP protocol version. However, HTTP connection to proxy always goes with HTTP/1.0 which upsets my proxy server.
Example:
<?php
$ctx = stream_context_create(
['http' => ['proxy' => 'tcp://corporate-proxy.example:3128']]
);
echo file_get_contents("https://getcomposer.org/versions", false, $ctx);
Result:
Warning: file_get_contents(): SSL: Connection reset by peer in a.php on line 5
Warning: file_get_contents(https://getcomposer.org/versions):
Failed to open stream: Cannot connect to HTTPS server through proxy in a.php on line 5
Actual request as seen by wireshark:
CONNECT getcomposer.org:443 HTTP/1.0
HTTP/1.1 426 Upgrade Required
date: Mon, 20 Jun 2022 10:23:30 GMT
server: envoy
connection: close
content-length: 0
My proxy server supports only HTTP/1.1. So it's would be very handy to have an option for configuring http protocol version for proxy connections.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with PHP's HTTP stream wrapper and the proxy CONNECT request path, comparing them with existing protocol_version handling for direct requests. Verify that the option applies to proxy connections and exercise the HTTPS-through-proxy example, confirming the CONNECT request uses the configured HTTP version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100