Re: WGLC #354 - ETags & conditional requests

John Sullivan <jsullivan@velocix.com> Fri, 22 June 2012 11:47 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 5DB8621F867E for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 22 Jun 2012 04:47:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.599
X-Spam-Level:
X-Spam-Status: No, score=-10.599 tagged_above=-999 required=5 tests=[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 9BsD+625iMF4 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 22 Jun 2012 04:47:47 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id 298C521F8674 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 22 Jun 2012 04:47:46 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.69) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1Si2Jc-0008VI-9I for ietf-http-wg-dist@listhub.w3.org; Fri, 22 Jun 2012 11:46:16 +0000
Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with esmtp (Exim 4.69) (envelope-from <JSullivan@velocix.com>) id 1Si2JL-0008Kt-3A for ietf-http-wg@listhub.w3.org; Fri, 22 Jun 2012 11:45:59 +0000
Received: from mail-out1.velocix.com ([81.134.152.10] helo=owa.velocix.com) by lisa.w3.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from <JSullivan@velocix.com>) id 1Si2JH-0004FJ-1K for ietf-http-wg@w3.org; Fri, 22 Jun 2012 11:45:57 +0000
Received: from orthrus.eng.velocix.com (172.18.32.42) by exccam.corp.velocix.com (172.18.4.40) with Microsoft SMTP Server (TLS) id 14.2.247.3; Fri, 22 Jun 2012 12:45:28 +0100
Message-ID: <4FE45AD8.3080801@velocix.com>
Date: Fri, 22 Jun 2012 12:45:28 +0100
From: John Sullivan <jsullivan@velocix.com>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.21) Gecko/20090320 Fedora/2.0.0.21-1.fc10 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Mark Nottingham <mnot@mnot.net>
CC: Zhong Yu <zhong.j.yu@gmail.com>, HTTP Working Group <ietf-http-wg@w3.org>, Ben Niven-Jenkins <ben@niven-jenkins.co.uk>
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>
In-Reply-To: <4DEBDF43-17B3-4EA7-A014-46932F037CCA@mnot.net>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Originating-IP: [172.18.32.42]
Received-SPF: none client-ip=81.134.152.10; envelope-from=JSullivan@velocix.com; helo=owa.velocix.com
X-W3C-Hub-Spam-Status: No, score=-1.9
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01
X-W3C-Scan-Sig: lisa.w3.org 1Si2JH-0004FJ-1K 74101f24d69701b87ca2bb0e0799343e
X-Original-To: ietf-http-wg@w3.org
Subject: Re: WGLC #354 - ETags & conditional requests
Archived-At: <http://www.w3.org/mid/4FE45AD8.3080801@velocix.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/13873
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: <E1Si2Jc-0008VI-9I@frink.w3.org>
Resent-Date: Fri, 22 Jun 2012 11:46:16 +0000

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.


> 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
--