[php-src] Issue #8832: Support "protocol_version" stream context option for proxy connections
| From: | onyn | Date: | Mon, 20 Jun 2022 10:52:29 +0000 |
| Subject: | [php-src] Issue #8832: Support "protocol_version" stream context option for proxy connections | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241767@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8832
Author: onyn
### Description
Hello. We have
[protocol_version](https://www.php.net/manual/en/context.http.php#context.http.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
<?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.