Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110242 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49338 invoked from network); 22 May 2020 12:18:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 May 2020 12:18:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4FFA1180211 for ; Fri, 22 May 2020 03:57:42 -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,HTML_MESSAGE, 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-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 ; Fri, 22 May 2020 03:57:41 -0700 (PDT) Received: by mail-lf1-f50.google.com with SMTP id w15so6240076lfe.11 for ; Fri, 22 May 2020 03:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SwgAMRTtCO+zP1lLm2/p9QEEh/flNreTDmWAQjvBiv8=; b=r5bKXK5lDc4dVufLw+g6WwRFmtLH7fLOAI1Nnxc4w6ojdN4+9ZMdQGpah6cowVhMhU SRd9C4kJwyS89QDpWQ6GhGkgA/qJ2Eeu6RiMOmSINM7E5AjvSOirOI9W2CWQkm5gnAi1 1KRIwZFFRNjjR3l7cM7549OiRrJ+Bwy35UqKmwuSKGapc/e03zcuWyVUOZS1kJf9P58v SUJz6VY1mGRVjW72gcPamkIHp3o32oC5bG7Wu2ESjqwpUuOStJclu2qqvI0b8z7PRCpX FTRg9IGTRr1SEFEGw/bbozo+X0lkCS6J06Gn+Ys0JysPXS9g+ebY51F7JH1SoEEl8dXl HBnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SwgAMRTtCO+zP1lLm2/p9QEEh/flNreTDmWAQjvBiv8=; b=mSgoYJtg7SHr3qvsekiVboB9ZLkTDUa/4ZdilcUzVmz5HRa7Q8xtabn1JbLGc0niva Oo6w/VaywEN4ghf8DvaZPD2uzxwKEsw1YD3XDardp7NHxtwO491APjSQ2is9mH7yGogZ Zs4c/4CAeS8/eWU5jY8GDuARKWKlOWzYgXlVTJb1s5tkMX36rbsuRHbVLmAjOp5cmHgQ kwJTJ1ZeUlv41pa06+ghQxJKpTrVIsdLQGRL4r9JYauEBB0bRiHwYPrTIzS4a9/EptJ9 6XsDiIs5qzaiqiDo0f6z3rktMOvrmLEudMJZul89aL6v4rgzKdAgVHXvoAbyOIW0IaFh 9wJg== X-Gm-Message-State: AOAM530c11lRKePzljua9MT/fs3AsQwXZZmRkZfhd/RJfbBMfru2KY5v pAlr14s06E8tEcoKga4n3rYad7Jh7ViT1kGSFRk= X-Google-Smtp-Source: ABdhPJz31T+xu3NuiQpXlWwFKv1eH6xtmhSR2KUsbDZA0f7v4+1bjOfEdOh6p9qbiewpbtLJpTtNaj9+RBzAtEFXARU= X-Received: by 2002:a05:6512:686:: with SMTP id t6mr7607310lfe.154.1590145059400; Fri, 22 May 2020 03:57:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 22 May 2020 12:57:23 +0200 Message-ID: To: Rowan Tommins Cc: PHP Internals Content-Type: multipart/alternative; boundary="0000000000006830d805a63a7f79" Subject: Re: [PHP-DEV] HTTP/1.1 by default in PHP 8.0 From: nikita.ppv@gmail.com (Nikita Popov) --0000000000006830d805a63a7f79 Content-Type: text/plain; charset="UTF-8" On Thu, May 21, 2020 at 11:54 PM 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? > Sounds good to me. Assuming there are no objections, feel free to just send a PR. @Eliot: Unfortunately we don't implement HTTP 2 in the http:// stream wrapper, so HTTP 1.1 is the best we can do there right now. We only provide HTTP 2 support through the curl extension. Implementing HTTP 2 support would certainly be a possibility, but I don't think it's particularly easy to do so without pulling in a dependency like nghttp2. @Max: I'm only guessing here, because I'm not familiar with the historical context, but I imagine part of the motivation is to support HTTP requests in a minimal build of PHP, which does not have any dependencies (that we do not bundle ourselves). We did actually provide an implementation of the http:// stream wrapper via curl for a long time, but dropped it at some point, because there were many subtle behavior differences to our native implementation. Regards, Nikita --0000000000006830d805a63a7f79--