Re: WGLC #354 - ETags & conditional requests

Mark Nottingham <mnot@mnot.net> Sat, 23 June 2012 02:11 UTC

Return-Path: <ietf-http-wg-request@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 E009811E808C for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 22 Jun 2012 19:11:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.322
X-Spam-Level:
X-Spam-Status: No, score=-10.322 tagged_above=-999 required=5 tests=[AWL=0.277, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PYz3lLRrqrc1 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 22 Jun 2012 19:11:28 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id B530B11E8088 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 22 Jun 2012 19:11:28 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.69) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1SiFnr-00060V-VR for ietf-http-wg-dist@listhub.w3.org; Sat, 23 Jun 2012 02:10:24 +0000
Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with esmtp (Exim 4.69) (envelope-from <mnot@mnot.net>) id 1SiFnS-0005yd-NT for ietf-http-wg@listhub.w3.org; Sat, 23 Jun 2012 02:09:58 +0000
Received: from mxout-07.mxes.net ([216.86.168.182]) by lisa.w3.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from <mnot@mnot.net>) id 1SiFnP-0002Vv-J0 for ietf-http-wg@w3.org; Sat, 23 Jun 2012 02:09:57 +0000
Received: from mnot-mini.mnot.net (unknown [118.209.196.77]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id 4B0B522E1F4; Fri, 22 Jun 2012 22:09:31 -0400 (EDT)
Mime-Version: 1.0 (Apple Message framework v1278)
Content-Type: text/plain; charset="iso-8859-1"
From: Mark Nottingham <mnot@mnot.net>
In-Reply-To: <4FE45AD8.3080801@velocix.com>
Date: Sat, 23 Jun 2012 12:09:28 +1000
Cc: Zhong Yu <zhong.j.yu@gmail.com>, HTTP Working Group <ietf-http-wg@w3.org>, Ben Niven-Jenkins <ben@niven-jenkins.co.uk>
Content-Transfer-Encoding: quoted-printable
Message-Id: <654C70AE-6881-44EE-9D99-80D98CBA1555@mnot.net>
References: <B5E63193-2450-41AD-A3AA-047755F2189D@niven-jenkins.co.uk> <6B348243-BC1C-48C0-822A-1649FDAF7091@mnot.net> <F65ED7E8-7B71-4DFC-98BC-51FCC1B4936B@mnot.net> <CACuKZqHdp2_sL=V9pg1cnTrYOwWjAzh4+d-wh+qpnFRzONyQ-g@mail.gmail.com> <4DEBDF43-17B3-4EA7-A014-46932F037CCA@mnot.net> <4FE45AD8.3080801@velocix.com>
To: John Sullivan <jsullivan@velocix.com>
X-Mailer: Apple Mail (2.1278)
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=-1.9
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001
X-W3C-Scan-Sig: lisa.w3.org 1SiFnP-0002Vv-J0 5990b7cb188fdcff64f9593a31bc7ceb
X-Original-To: ietf-http-wg@w3.org
Subject: Re: WGLC #354 - ETags & conditional requests
Archived-At: <http://www.w3.org/mid/654C70AE-6881-44EE-9D99-80D98CBA1555@mnot.net>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/13893
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>
Resent-Message-Id: <E1SiFnr-00060V-VR@frink.w3.org>
Resent-Date: Sat, 23 Jun 2012 02:10:23 +0000

On 22/06/2012, at 9:45 PM, John Sullivan wrote:

> Mark Nottingham wrote:
>> Of course, thanks; I always forget about the Range cases.
>> 
>> How about:
>> 
>> """
>> If any of the entity-tags listed in the If-Match field value match (as per Section 2.3.2) the entity-tag of the selected representation for the target resource, or if "*" is given and any current representation exists for the target resource, then the server may perform the request method as if the If-Match header field was not present.
>> 
>> Origin servers must not perform the requested method if none of the entity-tags match, or if "*" is given and no current representation exists; instead, they must respond with the 412 (Precondition Failed) status code.
>> 
>> Proxy servers using a cached response as the selected representation must not perform the requested method if none of the entity-tags match, or if "*" is given and no current representation exists; instead, they must forward the request towards the origin server.
>> """
> 
> That sounds good to me - just a minor question about the wording:
> 
>    If any of the entity-tags listed in the If-Match field value match
>    (as per Section 2.3.2) the entity-tag of the selected representation
>    for the target resource
> 
> That makes it sound like, in cases where the server has multiple
> representations available, it will first choose one, *then* compare
> with If-Match. (So if several equivalent versions are available and
> If-Match contains one ETag, and the server chooses the "wrong" one
> in step 1, it will always fail to match in step 2.) I just wondered
> whether the opposite way is specifically excluded: search the available
> versions for one matching an ETag present in If-Match, which will always
> succeed if a matching representation is present.

Yes. Note that "selected representation" is defined earlier:

> We use the term "selected representation" to refer to the current representation of the target resource that would have been selected in a successful response if the same request had used the method GET and had excluded all of the conditional request header fields. The conditional request preconditions are evaluated by comparing the values provided in the request header fields to the current metadata for the selected representation.

Now, a cache could have multiple representations of a resource stored, but again the selection algorithm again only has one output; see <https://svn.tools.ietf.org/svn/wg/httpbis/draft-ietf-httpbis/latest/p6-cache.html#caching.negotiated.responses>.

Cheers,


> 
> 
>> On 22/06/2012, at 1:43 AM, Zhong Yu wrote:
>> 
>>> A valid use case for GET + If-Match may be a range request.
>>> 
>>> If the intermediary has a cached representation with matching tag,
>>> which it has reason to believe would be the "selected representation"
>>> from the original server, the intermediary may safely do the shortcut.
>>> Otherwise the request has to be forwarded to the original server.
>>> 
>>> Zhong Yu
>>> 
>>> On Wed, Jun 20, 2012 at 10:47 PM, Mark Nottingham <mnot@mnot.net> wrote:
>>>> <http://trac.tools.ietf.org/wg/httpbis/trac/ticket/354>; related text is at <https://svn.tools.ietf.org/svn/wg/httpbis/draft-ietf-httpbis/latest/p4-conditional.html#header.if-match>
>>>> 
>>>> Usually, this isn't a problem, because If-Match is only used with methods that to be written through to the origin server. E.g., when you PUT or POST something.
>>>> 
>>>> However, we shouldn't count on that.
>>>> 
>>>> One way to address this would be to target the requirements at "origin server" rather than "server"; i.e. to say that we don't expect intermediaries to process If-Match.
>>>> 
>>>> Thoughts?
>>>> 
>>>> 
>>>> On 24/04/2012, at 3:47 AM, Ben Niven-Jenkins wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> Apologies that this mail misses the WG LC deadline, in Velocix we're reviewing all the HTTPBIS documents but we're a little behind, hence the late comments, sorry. (we're still reviewing so might have more comments as we work through the documents)
>>>>> 
>>>>> On page 14 of P4 it states:
>>>>> 
>>>>> If none of the entity-tags match, or if "*" is given and no current
>>>>> representation exists, the server MUST NOT perform the requested
>>>>> method.  Instead, the server MUST respond with the 412 (Precondition
>>>>> Failed) status code.
>>>>> 
>>>>> This appears to apply to intermediates, but If-Match has a problem
>>>>> here that If-Unmodified-Since does not. If a proxy has a cached
>>>>> entity which has a newer Last-Modified timestamp it *knows* that
>>>>> the conditional has failed and can generate the required
>>>>> 412 Precondition Failed response itself. Otherwise it can satisfy
>>>>> the request from cache. Or relay if there is no current cached
>>>>> version.
>>>>> 
>>>>> But because multiple responses with different ETags may exist then a cache receiving If-Match with one etag, when it has a different etag cached, can not know for sure that the request etag does not exist. If it were to respond with a 412 status it would effectively be preventing the use of that conditional.
>>>>> 
>>>>> It would appear that the only two options available to an intermediate are to satisfy the request in the case of a known match, and relay upstream in all other cases (which would be in conflict with the spec as quoted above).
>>>>> 
>>>>> Thanks
>>>>> Ben
>>>>> 
>>>>> 
>>>> 
>>>> --
>>>> Mark Nottingham   http://www.mnot.net/
>>>> 
>>>> 
>>>> 
>>>> 
>> 
>> --
>> Mark Nottingham   http://www.mnot.net/
>> 
>> 
>> 
>> 
>> 
> 
> 
> John
> -- 
> 

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