Re: Server Push and Content Negotiation

Mark Nottingham <mnot@mnot.net> Wed, 07 September 2016 03:57 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 18E2912B110 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 6 Sep 2016 20:57:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -8.429
X-Spam-Level:
X-Spam-Status: No, score=-8.429 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.508, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 wnKduNTzdnVl for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 6 Sep 2016 20:57:22 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 61F1312B016 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 6 Sep 2016 20:57:22 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1bhTv9-0003ds-Kb for ietf-http-wg-dist@listhub.w3.org; Wed, 07 Sep 2016 03:53:07 +0000
Resent-Date: Wed, 07 Sep 2016 03:53:07 +0000
Resent-Message-Id: <E1bhTv9-0003ds-Kb@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <mnot@mnot.net>) id 1bhTv2-0003co-Ag for ietf-http-wg@listhub.w3.org; Wed, 07 Sep 2016 03:53:00 +0000
Received: from mxout-07.mxes.net ([216.86.168.182]) by maggie.w3.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from <mnot@mnot.net>) id 1bhTux-0003Hk-CM for ietf-http-wg@w3.org; Wed, 07 Sep 2016 03:52:59 +0000
Received: from [192.168.3.104] (unknown [124.189.98.244]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id 62CBC22E1F3; Tue, 6 Sep 2016 23:52:31 -0400 (EDT)
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\))
From: Mark Nottingham <mnot@mnot.net>
In-Reply-To: <CA+3+x5HRk0HGsKNk8azzs_J3Au-eENC-VERGeOKo1me04K=bGA@mail.gmail.com>
Date: Wed, 7 Sep 2016 13:52:28 +1000
Cc: Patrick McManus <mcmanus@ducksong.com>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <6F0A0D9F-CFA9-47BF-ADFA-1C5503B0C2A3@mnot.net>
References: <F638033C-C1E0-447D-915E-A0B947629EA7@mnot.net> <CAOdDvNomUHFGGDXu2HtGaY4iNOBr=oHATnMfcLMtR5jz4CW2RA@mail.gmail.com> <CA+3+x5HRk0HGsKNk8azzs_J3Au-eENC-VERGeOKo1me04K=bGA@mail.gmail.com>
To: Tom Bergan <tombergan@chromium.org>
X-Mailer: Apple Mail (2.3124)
Received-SPF: pass client-ip=216.86.168.182; envelope-from=mnot@mnot.net; helo=mxout-07.mxes.net
X-W3C-Hub-Spam-Status: No, score=-8.4
X-W3C-Hub-Spam-Report: AWL=1.216, BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, 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: maggie.w3.org 1bhTux-0003Hk-CM fc371d809f4bf0dabecaa5379470940b
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Server Push and Content Negotiation
Archived-At: <http://www.w3.org/mid/6F0A0D9F-CFA9-47BF-ADFA-1C5503B0C2A3@mnot.net>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/32380
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: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

> On 25 Aug 2016, at 3:12 AM, Tom Bergan <tombergan@chromium.org> wrote:
> 
> On Tue, Aug 23, 2016 at 9:26 PM, Mark Nottingham <mnot@mnot.net> wrote:
>> The interaction of Content Negotiation and Server Push isn't really specified. Depending on how it's implemented, it could be quite tricky, because it seemingly requires the server to guess what the client would have sent, in order to negotiate upon it.
> 
> This sounds right to me. Though, if the server and client are well-behaved, the worst-case is wasted bandwidth, not an incorrect response:
> - If the server pushes response with a non-empty Vary (or Key) field, it should make a guess for all headers mentioned in Vary (or Key) and include those guesses in the PUSH_PROMISE
> - The client should is match pushed (request, response) pairs to client requests using the Vary (or Key) field in the usual way

Right. One complicating factor is how closely current clients follow <http://httpwg.org/specs/rfc7234.html#caching.negotiated.responses>, versus using their own heuristics.


>> Additionally, the server needs to know what the base capabilities and preferences of the client are, to allow it to select the appropriate responses to push. To aid this, servers SHOULD create a PUSH_PROMISE's request by copying the values of the request header fields mentioned in the `Vary` response header field from the request that is identified by the `PUSH_PROMISE` frame's Stream ID.
> 
> For fields like Accept-Encoding and User-Agent, that's probably sufficient. But in general, it's not quite that simple -- e.g., what if the response has "Vary: Cookie", which can in theory change between requests? You make a similar observation when talking about how Client Hints might change between requests. Also see the discussion for "Rule #4" in this doc:
> https://docs.google.com/document/d/1K0NykTXBbbbTlv60t5MyJvXjqKGsCVNYHyLEXIxYMv0

Don't push something with Vary: Cookie? :)

Otherwise, the client is going to have to get into the business of checking a request to figure out "would I have sent that request?" Making that more complicated is the secondary question, "when?", because things like cookies can change quite quickly.

Client Hints is a bit easier, because AIUI the response is still presumed to be usable by the client, even if the hints don't line up.


>> I'd be tempted to go even further and say that PUSH_PROMISE headers SHOULD NOT contain `DNT`, `User-Agent`, `Cookie` or similar headers UNLESS they were specified in Vary.
> 
> I'd agree with that. I would say that PUSH_PROMISE only needs to contain header fields that describe the cache key of the response (which includes :method, :scheme, :path, :authority, and any header field referenced by Vary or Key).
>  
>> What do people think -- is this worth specifying? How are implementations currently doing this?
> 
> Chrome is not doing anything (yet):
> https://bugs.chromium.org/p/chromium/issues/detail?id=554220
> 
> I think most readers come to roughly the same conclusion when reading the RFC, but there is enough uncertainty that I think this is worth specifying in more detail.

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