Hi Rowan, Rowan Collins wrote:
I think it would be good to get this support into a better state, make it easier to switch on - e.g. with an INI setting, or some new stream URL syntax - and possibly make HTTP/1.1 the default in PHP 8.0.
HTTP/1.1 ought to be the default now, I think. The lack of the Host: header in HTTP/1.0 is pretty serious given how much of the web runs on vhosts now.
As I understand it, supporting HTTP/1.1 as a client requires the following mandatory features on top of HTTP/1.0: a) Send a "Host" header with every request. (RFC 7230 Section 5.4) b) Support persistent connections, or send "Connection: Close" with each request. (RFC 7230 Section 6.1) c) Ignore 1xx status lines (notably, "100 Continue") "even if the client does not expect one" (RFC 7231 Section 6.2) d) Support "chunked" transfer encoding (RFC 7230 Section 4.1) Let me know if there are any I've missed.
I don't know about ones you've missed, but the Host header, persistent connections and chunked transfer were the main ones that caught me out when I wrote my own minimal HTTP client a while ago. In order to connect to many modern websites, you need a Host: header, and in order to use a Host: header, you need to use HTTP/1.1 (if you don't, servers will sometimes send you back a 1.1 response anyway!). In order to understand the output of those servers, you may need chunked transfer encoding, particularly if they're running dynamic code (say, PHP), and you need to specify the connection is non-persistent, lest you wait forever.
What do people think? Would this be a worthwhile effort?
I think it's the absolute minimum we need to do to have it work properly at all. Using HTTP/1.0 alone probably means PHP's HTTP stream wrapper support is effectively broken at present, if my experiences are anything to go by.
Thanks for bringing this up! -- Andrea Faulds https://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php