Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110237 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 4627 invoked from network); 21 May 2020 23:14:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 May 2020 23:14:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 357941804F6 for ; Thu, 21 May 2020 14:53:57 -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=0.6 required=5.0 tests=BAYES_50,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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 ; Thu, 21 May 2020 14:53:56 -0700 (PDT) Received: by mail-wm1-f41.google.com with SMTP id n18so7935584wmj.5 for ; Thu, 21 May 2020 14:53:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=yyR/R5WlYuExYobESHgy7HFO5dccx19SOzi/vCYm8JI=; b=LAB1sIzSD5Vd03Sf/ngatAU7FNeowKqLuXNUGYzwg5lTIcIh/7Sxa1Nc3WrM4gDwrv 8r07RSrsOWpXLlgDTpRR8YniLMRcxamfuBx2qLa/K/uF4Y9AMGqAAg6ObLz5yBYtTP4R I24/ODzixWks42EpzkGNhbysWVHvL3foKXosycgLlE4TTMKJtTetLhRy7Q2Mce2gfosA Zji3dv5JBDLD95odtGTvNPuslUlYpU74QOQATNskQBxhik/ARp1aKRW7QRSfh1ZPy0DR 7fbdRdGGaIs9sWTdxG1PLzvpsH+IUAQNuYmQlNt3s3qk5G5w+j2smE+CkxIgN5E+I3Cx aXCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=yyR/R5WlYuExYobESHgy7HFO5dccx19SOzi/vCYm8JI=; b=OwvY65twb25KSqFyIxrpSCcBoUnxMNtf+gEYbZOJfwaPDiAgXJHqA5vTpJEeWkjkOl GCuq93tsMVP5667Q9wB6rjI6k4N5R9raG+XVyfX4R1iwnzC4EyGA7phybVcz7DxrPnOV al1RjlPssrT6Nnke2WzOMWU515CFOrUXV2TP4BgVh/Q3CsXE3JNpYoW0/5aCVMbPcBmk 1iTtrRokwEVUvZhRn21XKBZhQ2w4M4nuuZTxO82HrG2GWaY1ypLmTj7Efxo8934pxRjn Yc4tqc6vfIZg7Im9YB1ydF8AsMZ1xaWXqoGtpe84UpARizM4xZ3ICnaGFbdNTgL82Aqe lbtw== X-Gm-Message-State: AOAM533AbFRAwNXc7u5qKksD7rEZOI+tJKBxstHqBTkDrt1Kid8BBDwY qECFrPRdDg6faJL9amCtlUF9MHYA X-Google-Smtp-Source: ABdhPJwbIiim8xZ55rkkLyfiYHYkNO9dAUeiIcynEQIRvu9lCDb0yJaFgs8Zmqx1779XflWeU9O2Tw== X-Received: by 2002:a1c:9ac1:: with SMTP id c184mr2964060wme.152.1590098034320; Thu, 21 May 2020 14:53:54 -0700 (PDT) Received: from [192.168.0.14] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id c17sm7653544wrn.59.2020.05.21.14.53.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 May 2020 14:53:53 -0700 (PDT) To: PHP Internals Message-ID: Date: Thu, 21 May 2020 22:53:53 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: HTTP/1.1 by default in PHP 8.0 From: rowan.collins@gmail.com (Rowan Tommins) 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]