Re: H2 vs responses which should not carry any payload

Mark Nottingham <mnot@mnot.net> Sat, 24 October 2020 02:11 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 90B2D3A0C01 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 23 Oct 2020 19:11:07 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.748
X-Spam-Level:
X-Spam-Status: No, score=-2.748 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=mnot.net header.b=WzeTtj6o; dkim=pass (2048-bit key) header.d=messagingengine.com header.b=aAX7KXK0
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ll_dMRzp9CsC for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 23 Oct 2020 19:11:03 -0700 (PDT)
Received: from lyra.w3.org (lyra.w3.org [128.30.52.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1C3A83A0BFC for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 23 Oct 2020 19:11:02 -0700 (PDT)
Received: from lists by lyra.w3.org with local (Exim 4.92) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1kW8yA-0000qy-LN for ietf-http-wg-dist@listhub.w3.org; Sat, 24 Oct 2020 02:07:46 +0000
Resent-Date: Sat, 24 Oct 2020 02:07:46 +0000
Resent-Message-Id: <E1kW8yA-0000qy-LN@lyra.w3.org>
Received: from titan.w3.org ([128.30.52.76]) by lyra.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <mnot@mnot.net>) id 1kW8y8-0000qD-It for ietf-http-wg@listhub.w3.org; Sat, 24 Oct 2020 02:07:44 +0000
Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by titan.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <mnot@mnot.net>) id 1kW8y6-00019w-Cf for ietf-http-wg@w3.org; Sat, 24 Oct 2020 02:07:44 +0000
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id ACB6B78C; Fri, 23 Oct 2020 22:07:25 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 23 Oct 2020 22:07:25 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mnot.net; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=D FTFlFApOnyBbFts21ttJMpqwuoypWYZnjXrCZ4f8KE=; b=WzeTtj6oXXs2znDQE LsfSUZ0uAXwCQChOxPCt6T501wZV3Sd7eb/NBw+d4HHSUorS8mUouvJDBQEex/OW K2TxfRyWeqdmkwGU5hYpaRpePvMrxUDe+pAFnQpOLft0HxlAKxEJNYx+YvnqFkvy TpXjmk2gc0rURA2vY/PXESi1EukMwBvcCuWI89+ozFvmYL2ZNH7FQ9825W0/IzLI ZKCcuzdbAOmWHjSDFBXpEAJc3gy6pZ6NxKFiQG27pg3/KKOmH+QA766hsdblLg+N 1c/tGdSdiIE2SD9tqNM0GkKb7T6Wl93+WdtiVvZF0AFar2dEaGE+gTSQwkP1ZSSZ yhoRA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=DFTFlFApOnyBbFts21ttJMpqwuoypWYZnjXrCZ4f8 KE=; b=aAX7KXK0/6PH6zZ0LRWGjGz18YY/6ZeM43H8lCUCRuft13hEWChFA7o9A xjA1D3FL5JTEmfIkhI49uYgQrEu0/aAnb5w5GnzVU3H0Dpj4cr3GNO9sjYep1J8p my8BDG29ukgecZs/fZcjtyZkcgRJzdc37eItXeauVfzGrdHR/LVmr79w6mVHg0Z4 Tenv1nnXDlwlZTsLVD9QtBVpSLRi5MFlLSIpFDFIOB3JgmchmaNTYRUK9Likm3rh Jr72EHo/RJ6WqKjfxBnl4bvRclgoD+oLIPyiTtT2rudKXRAKqS2uU0Hr/AR59rKB VNM50nHECJaJ6ZMp/z1zUp0xhI+5g==
X-ME-Sender: <xms:XIyTX8ur5KLLKIhkeK1S5ZH87yIHOEERh9x385fkBAuK3XMyn9TtLA> <xme:XIyTX5ejz37Oi92KYXn8B-aWV2mBWPtrnsWp7X5MQCFoA6IeoaSLAbQBDVbXOFSw7 GHFEnoY0u42wCoYjA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkedugdehhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurheptggguffhjgffgffkfhfvofesthhqmh dthhdtvdenucfhrhhomhepofgrrhhkucfpohhtthhinhhghhgrmhcuoehmnhhothesmhhn ohhtrdhnvghtqeenucggtffrrghtthgvrhhnpeevffffhfduteevvefhueffieegtdeutd ehffeltefffedttdeggeejheeiueetteenucffohhmrghinhepmhhnohhtrdhnvghtnecu kfhppeduudelrddujedrudehkedrvdehudenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehmnhhothesmhhnohhtrdhnvght
X-ME-Proxy: <xmx:XIyTX3yp9kM46nVi0QxtxDnTcV1mOzYKSZVTIj7hCKdm_IZq-R3yxQ> <xmx:XIyTX_P9fpct_sQvpSay7_aSXMiu7gmJ5hISmfFj8XsieLPaWA4Yeg> <xmx:XIyTX882gqtTxabvxcqnd_hDlfrSDDoWGAp6EeUKaO60pCDRV7n19w> <xmx:XYyTX-KuiTWqtWU-j9RB6DuvP4TnlEyHaNGbbZjwWDYT4rYaajoCVw>
Received: from [192.168.7.30] (119-17-158-251.77119e.mel.static.aussiebb.net [119.17.158.251]) by mail.messagingengine.com (Postfix) with ESMTPA id 18E40306467E; Fri, 23 Oct 2020 22:07:22 -0400 (EDT)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\))
From: Mark Nottingham <mnot@mnot.net>
In-Reply-To: <20201023045426.GB4941@1wt.eu>
Date: Sat, 24 Oct 2020 13:07:19 +1100
Cc: HTTP Working Group <ietf-http-wg@w3.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <7744FD17-E33C-4EB6-A527-95FA430D0B06@mnot.net>
References: <20201023045426.GB4941@1wt.eu>
To: Willy Tarreau <w@1wt.eu>
X-Mailer: Apple Mail (2.3608.120.23.2.1)
Received-SPF: pass client-ip=64.147.123.25; envelope-from=mnot@mnot.net; helo=wout2-smtp.messagingengine.com
X-W3C-Hub-Spam-Status: No, score=-9.8
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, W3C_AA=-1, W3C_DB=-1, W3C_IRA=-1, W3C_IRR=-3, W3C_WL=-1
X-W3C-Scan-Sig: titan.w3.org 1kW8y6-00019w-Cf 8cf6d2531f4e8dba36423dcba0bc3595
X-Original-To: ietf-http-wg@w3.org
Subject: Re: H2 vs responses which should not carry any payload
Archived-At: <https://www.w3.org/mid/7744FD17-E33C-4EB6-A527-95FA430D0B06@mnot.net>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/38115
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <https://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

My .02 -

204/304/1xx and head responses are defined by HTTP's core semantics to not have a body. 

HTTP/1 enforced those in the framing mechanism (if you didn't, you lost framing reliability and Bad Things happened).

HTTP/2 doesn't explicitly enforce them, which means that we're now in similar territory to "Can GET have a request body?" ... and we've all seen how much angst that causes.

Whether or not you should strip them, generate an error, or just pass them through depends on what you're doing. In general, HTTP wants implementations that don't have to "know" the whole protocol, to allow extensions to be deployed successfully, and to allow simpler implementations to succeed. So while HTTP/1 requires that implementations understand these situations to maintain framing, I think it's reasonable to not have that requirement (and we don't) in HTTP/2, because framing doesn't depend upon it.

That doesn't mean that putting a response body on a 304 or HEAD response is interoperable or a good thing to do; it just means that you're not obligated to refuse that message -- and we should be super crisp in http-core about what this means.

Cheers,



> On 23 Oct 2020, at 3:54 pm, Willy Tarreau <w@1wt.eu> wrote:
> 
> Hi all,
> 
> we've recently faced a stupid case in haproxy with H2 and I realized that
> I didn't find the good response in the spec.
> 
> What we've seen is that a client sends a HEAD request, which we forward
> to the server. In response the server returns an error with some payload
> (possibly a typical pre-made error page that doesn't care about the method),
> and haproxy forwards both the HEADERS and DATA frames to the client, then
> the client complains about protocol violations (I don't know yet what the
> client is for now but I don't think it's important).
> 
> We were wondering where we ought to trim the payload in this case (and
> for 204/304 as well), whether we ought to do this while reading the
> response from the server or when sending the response do the client, and I
> figured that nowhere at all in 7540 is mentioned anything about 204/304/HEAD
> and that made me start to wonder if adjusting this at the H2 level is the
> right solution, and if we ought to do anything about it or not (since
> after all maybe everyone is right in this whole chain).
> 
> We all know that 204/304/HEAD are between transport and semantics because
> for H1 these directly affect the parsing. From this perspective it would make
> sense to consider that H2 should drop these. But if we consider semantics
> only, it also makes sense to consider that H2 should let everything pass
> through.
> 
> And even then, do all implementations accept, say, a HEADERS frame with
> no ES flag in response to a HEAD request, followed by an empty DATA frame
> carrying the ES flag ? At the semantic level it's OK since there's no
> payload, but I can understand how some could find it annoying to wait
> for DATA frames when no payload is expected (it's our case as well as
> part of the possible fixes for this).
> 
> For those who want a bit more details, internally we're not directly
> forwarding frames but transcoding these into a version-agnostic HTTP
> representation that allows us to have either H1 or H2 on any side. This
> internal version carries the semantics. If we decide that H2 has nothing
> to do with this, we can decide to perform the filtering at the semantics
> layer, while knowing that when it comes to H1 it still has to take these
> special cases for the messaging anyway. It even makes me suspect that
> the contraints are double, in that HEAD/204/304 ought to see no response
> payload at the semantic layer, and that H1 is a special case in that it
> cannot accept that either at the transport layer to respect the messaging
> and that it's not a problem if it duplicates that check.
> 
> I'm interested in any opinion on this subject (or any pointers to anything
> I could have missed).
> 
> Thanks!
> Willy
> 

--
Mark Nottingham   https://www.mnot.net/