Re: Cache control in trailers?

"Roy T. Fielding" <fielding@gbiv.com> Fri, 05 February 2021 19:04 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 C56493A0EA7 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 5 Feb 2021 11:04:34 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.771
X-Spam-Level:
X-Spam-Status: No, score=-2.771 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.249, MAILING_LIST_MULTI=-1, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=gbiv.com
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 MsR7W5mxDqe9 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 5 Feb 2021 11:04:31 -0800 (PST)
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 9902E3A0E7E for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 5 Feb 2021 11:04:31 -0800 (PST)
Received: from lists by lyra.w3.org with local (Exim 4.92) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1l86ML-0007mL-Ik for ietf-http-wg-dist@listhub.w3.org; Fri, 05 Feb 2021 19:01:37 +0000
Resent-Date: Fri, 05 Feb 2021 19:01:37 +0000
Resent-Message-Id: <E1l86ML-0007mL-Ik@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 <fielding@gbiv.com>) id 1l86MK-0007lV-Mz for ietf-http-wg@listhub.w3.org; Fri, 05 Feb 2021 19:01:36 +0000
Received: from dog.elm.relay.mailchannels.net ([23.83.212.48]) by titan.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <fielding@gbiv.com>) id 1l86MI-0005Sw-FH for ietf-http-wg@w3.org; Fri, 05 Feb 2021 19:01:36 +0000
X-Sender-Id: dreamhost|x-authsender|fielding@gbiv.com
Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 06E5A1E255B for <ietf-http-wg@w3.org>; Fri, 5 Feb 2021 19:01:22 +0000 (UTC)
Received: from pdx1-sub0-mail-a67.g.dreamhost.com (100-105-161-48.trex.outbound.svc.cluster.local [100.105.161.48]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 2C9681E368D for <ietf-http-wg@w3.org>; Fri, 5 Feb 2021 19:01:21 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|fielding@gbiv.com
Received: from pdx1-sub0-mail-a67.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.105.161.48 (trex/6.0.2); Fri, 05 Feb 2021 19:01:21 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|fielding@gbiv.com
X-MailChannels-Auth-Id: dreamhost
X-Vacuous-Shade: 576b6bd177a9912b_1612551681842_3638374094
X-MC-Loop-Signature: 1612551681838:2002146508
X-MC-Ingress-Time: 1612551681837
Received: from pdx1-sub0-mail-a67.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a67.g.dreamhost.com (Postfix) with ESMTP id DA6D07F03F for <ietf-http-wg@w3.org>; Fri, 5 Feb 2021 11:01:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gbiv.com; h=from :content-type:content-transfer-encoding:mime-version:subject :date:references:to:in-reply-to:message-id; s=gbiv.com; bh=PpCyG hMjPofPoR842t+K1buaIkM=; b=Tc8XmbQ/oMYZKZykpx9AW0bd9lGOuBJVSZ3Je elbzuEjsD5SL7N1NTkCuQ9qTA7BvgQyuT8pK3jQtcwVxk1bWDzD4Jjg2oIcqYVIG KqUu4UwnSAYPC5zaluwjloDyM6QoezUJFpRCwyivXBgb30r5EteP7bHUPt6uOrch FMbndM=
Received: from [192.168.1.5] (ip68-101-102-139.oc.oc.cox.net [68.101.102.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: fielding@gbiv.com) by pdx1-sub0-mail-a67.g.dreamhost.com (Postfix) with ESMTPSA id 5B3167E0C0 for <ietf-http-wg@w3.org>; Fri, 5 Feb 2021 11:01:19 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a67
From: "Roy T. Fielding" <fielding@gbiv.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\))
Date: Fri, 05 Feb 2021 11:01:18 -0800
References: <20210203195031.GD31744@1wt.eu> <58FDCDB1-63A9-4FF1-A348-CCDDC8D19F86@greenbytes.de> <CAAPGdfHH_05piq9JgMiX1BBC1_CQtQ7TUNnzvcmHFFD=TK0Kxw@mail.gmail.com> <6820.1612436015@critter.freebsd.dk> <CAAPGdfHT-_4UM6JWNs1SUSHRzuk+-kdi2wd3Zc66FCUxj9Bq0g@mail.gmail.com> <7752.1612455032@critter.freebsd.dk> <em0f4be291-4358-4a39-bc8f-b3fc2833c46c@bombadil> <10002.1612482759@critter.freebsd.dk> <em968d8077-b288-43a9-89ff-14e5eb551c32@bombadil> <11350.1612510775@critter.freebsd.dk> <20210205074602.GA2292@1wt.eu> <11560.1612511507@critter.freebsd.dk> <CAAPGdfGcZjEOX-eo_1Z_Xu+Vdsv60sCOKuhQG+aiYdLpRh=kDQ@mail.gmail.com> <0ff80246-867f-064d-1035-17564b9d62a8@gmx.de> <CAAPGdfG-QftYscerK=9YskXfA_mn+kfQnjGrBd64Hsm2rYrhrQ@mail.gmail.com> <28266.1612518581@critter.freebsd.dk>
To: HTTP Working Group <ietf-http-wg@w3.org>
In-Reply-To: <28266.1612518581@critter.freebsd.dk>
Message-Id: <4554B625-851B-42D7-AF78-7D28F8C8E8E9@gbiv.com>
X-Mailer: Apple Mail (2.3445.104.17)
Received-SPF: pass client-ip=23.83.212.48; envelope-from=fielding@gbiv.com; helo=dog.elm.relay.mailchannels.net
X-W3C-Hub-DKIM-Status: validation passed: (address=fielding@gbiv.com domain=gbiv.com), signature is good
X-W3C-Hub-Spam-Status: No, score=-9.1
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_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=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 1l86MI-0005Sw-FH 5d82f05e3ee547f7cdd97f21c5f83027
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Cache control in trailers?
Archived-At: <https://www.w3.org/mid/4554B625-851B-42D7-AF78-7D28F8C8E8E9@gbiv.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/38538
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>

If we are going to continue this conversation, I insist that participants
actually read the current definition of trailers under WGLC in 

  https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#trailer.fields

and

  https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#field.trailer

and then study existing use beyond what you have implemented yourself.

It takes only five minutes of searching to dig up many articles from people
using trailers in practice within APIs, CDNs, backend systems, etc.  E.g.,

   https://engineering.pivotal.io/post/http-trailers/
   https://www.fastly.com/blog/supercharging-server-timing-http-trailers
   https://webtide.com/http-trailers-in-jetty/
   https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md
   https://grpc.github.io/grpc/cpp/md_doc__p_r_o_t_o_c_o_l-_w_e_b.html
   https://golang.org/pkg/net/http/#example_ResponseWriter_trailers
   https://github.com/envoyproxy/envoy/issues/2394

HTTP is not limited by what browsers currently use! We should all know that
by now without me having to repeat it ad nauseum. Browsers are important
but make up less than 1% of the total HTTP implementations. Nevertheless,
we have deliberately fixed several aspects of trailers in the revision, specifically
so that they can be better implemented by intermediaries and browsers, and
won't override header field values by default.

This is not to say that the current description is perfect. It is somewhat
limited by past definition and usage of trailers and the various ways they
might be sent for HTTP/1, 2, and 3. We have worked hard to define what
has been implemented widely now and avoid prohibiting what has only
been implemented as experiments, such as mid-stream trailers.

Any statements suggesting that trailers are "not in current use" or that
"nobody implements trailers" are obviously false. They are being used.
They would be used a lot more if we don't arbitrarily break them without
understanding the existing implementations.

To answer the original question, there is nothing stopping a server from
sending

    Cache-Control: must-revalidate
    Trailer: cache-control
... body...
    Cache-Control: public

or

    Cache-Control: max-age=3200
    Trailer: end-status
... body...
    End-Status: 500

or

    Cache-Control: max-age=3200
    Trailer: end-cache-control
... body...
    End-Cache-Control: oops

and simply ask cache implementations to do the right thing once you define
what that right thing might be. These are already supported by the core spec,
but they would need to be defined as extensions to be interoperable.

Personally, I think end-status is the easiest and most reusable solution, for
any number of features that might need to know if something broke. However,
Willy is right that saying must-revalidate up front and then softening that
at the end would be the safer choice where completion is more important
than default performance. I suggest that choice needs to be resource-specific.

Please, if there is something specifically wrong with the current definitions
of Trailers in the specs currently in WGLC, and its not just a personal opinion
about their usage, suggest a better definition that doesn't break other
people's software, or suggest some additional sentences that might clarify
the work so that the next generation of apps can use this feature without
prior shared agreement.

....Roy