Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111202 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31274 invoked from network); 27 Jul 2020 23:29:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jul 2020 23:29:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E45CA180088 for ; Mon, 27 Jul 2020 15:24:54 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 27 Jul 2020 15:24:54 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id a15so16356100wrh.10 for ; Mon, 27 Jul 2020 15:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=6uS26yoD15i0xhiuV5ig8jFm38lr7qQZoSQ1u+vJQ74=; b=YKQIblTcVYGw8kyAQMW6cn+xHdYm0yYv37MFezqNddi/BFloLDOfrqBUJGsDSS+xaE bkkmQ4x7PBIViEYujweSLvcFregaKfCa6D707mWaO7G7vr2JDJNjO+FaxWfPNd9nx93X ydeqdzbMUG0gCWxfQV5Wp9FL0YBHYgMxhPr9798Wz6aOw5Noz/P+1OS5jPywcOsjsx+g 1yLZK8T7QbltELhgfSgJ0K4yDQ/1DsRTR3SwwaPimRVYFlFnub8xIU/NjE+3A8fWiEBt XEs34JESYcDGypbOXeMC9/XrjIW/8FcWWwaNtb0nCxk4D1SY+VDqz5gadgNyzq3cMWBu 0vuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=6uS26yoD15i0xhiuV5ig8jFm38lr7qQZoSQ1u+vJQ74=; b=WTNke2fzQ0ZYPf1nVcqiTDgm2dYhzrQK8fvx+XCraHoiuzKQpXOw03xmJRKKlFNzYw TdIMVXLE5FKM9NJ6dYFccdlI2Y/6S5tZeG7+FrJTZUJOcvOi/jxr7HgjltJ5Zln8YWEu dIbXSOmt9hEQj33/x7aInnSGC5GaqcFmoa7NNLsa5wNgUTKuO3ubRM+LZhwXXv63fSHL 7Wcob5wTW9irYRbzZenUw6c21fUV105HyNZTG1gArxEUkHThpKECHy5599dv6yzw7U3u 687Q2S2TQ+O7cjSsx80f7fWHxkh7NX5l5rqfP8AmKVkWpRypc6eW5BzV9RxqIjt36mpc dFhQ== X-Gm-Message-State: AOAM531J5eIqrPn/S/sKBiw15ncIfK2hwS5St6vZQVLwbftWzF9IIRhv 38gO3JoMgASKOo1f9IDKWR+1dUCr X-Google-Smtp-Source: ABdhPJxiMAGC1mfQ6xa1JOpwwe2YGb24bpd7tgn/BpRLR6QKXefE5C7/flyjydNVzxatzbIgJ+/9Vg== X-Received: by 2002:adf:8545:: with SMTP id 63mr15364080wrh.68.1595888689705; Mon, 27 Jul 2020 15:24:49 -0700 (PDT) Received: from [192.168.0.22] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id v15sm1149343wmh.24.2020.07.27.15.24.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jul 2020 15:24:49 -0700 (PDT) To: PHP Internals References: Message-ID: <9d28ade6-1a70-9850-3bc0-64050c0dcbe4@gmail.com> Date: Mon, 27 Jul 2020 23:24:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: HTTP/1.1 by default in PHP 8.0 From: rowan.collins@gmail.com (Rowan Tommins) Hi all, A couple of months ago I revived my suggestion to make stream wrappers advertise HTTP/1.1 by default (full message below), and then Real Life intervened and I didn't raise the PR. The implementation (which is a one-character change) is now here: https://github.com/php/php-src/pull/5899 I realise it's now rather last-minute for 8.0, so if anyone thinks it should have more careful thought, or an RFC, it will have to wait. If there are no objections, though, it would be nice to have it merged before the freeze. Thanks, Rowan On 21/05/2020 22:53, Rowan Tommins wrote: > Hi all, > > A few years ago, I posted a message suggesting that PHP improve > support for HTTP/1.1 in its stream wrapper functions: > https://externals.io/message/96192 > > A quick summary of the current situation: > > * HTTP/1.1 was officially standardised in January 1997, and most web > browsers had already implemented it by then > * PHP has a very simple HTTP client implementation, used by the > "http:" and "https:" stream wrappers, and also by extensions which > make HTTP requests, such as ext/soap > * The client implementation defaults to advertising HTTP/1.0 requests, > unless over-ridden by a stream context option > * Since a lot of servers only actually talk HTTP/1.1, the client > mostly acts as an HTTP/1.1 client even when advertising HTTP/1.0 > > > In my previous message, I identified four requirements in HTTP/1.1 but > not HTTP/1.0 that are relevant to a client: > > 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) > > > The PHP client now supports all four regardless of protocol version > configured, i.e. it always sends "Host:" and "Connection: Close" > headers; and always handles "100 Continue" and "Transfer-Encoding: > Chunked" if returned by the server. > > I would like to propose that the client advertises HTTP/1.1 in its > requests by default in PHP 8.0.  Users can opt out of this behaviour > in a fully backwards- and forwards-compatible way if necessary using a > stream context option, e.g.: > https://gist.github.com/IMSoP/a685fed6589435530102d57138755511 > > > What are people's opinions? Does this need an RFC, or should I just > submit a PR if nobody objects? > > > Regards, > -- Rowan Tommins (né Collins) [IMSoP]