Re: [http-state] Is this an omission in the parser rules of draft-ietf-httpstate-cookie-21?

Adam Barth <ietf@adambarth.com> Fri, 11 February 2011 01:09 UTC

Return-Path: <ietf@adambarth.com>
X-Original-To: http-state@core3.amsl.com
Delivered-To: http-state@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 5130D3A6860 for <http-state@core3.amsl.com>; Thu, 10 Feb 2011 17:09:23 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.565
X-Spam-Level:
X-Spam-Status: No, score=-1.565 tagged_above=-999 required=5 tests=[AWL=1.412, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U-8JycM7snPK for <http-state@core3.amsl.com>; Thu, 10 Feb 2011 17:09:22 -0800 (PST)
Received: from mail-vw0-f44.google.com (mail-vw0-f44.google.com [209.85.212.44]) by core3.amsl.com (Postfix) with ESMTP id 2D6233A6827 for <http-state@ietf.org>; Thu, 10 Feb 2011 17:09:22 -0800 (PST)
Received: by vws7 with SMTP id 7so1407666vws.31 for <http-state@ietf.org>; Thu, 10 Feb 2011 17:09:35 -0800 (PST)
Received: by 10.220.188.72 with SMTP id cz8mr692865vcb.64.1297386574703; Thu, 10 Feb 2011 17:09:34 -0800 (PST)
Received: from mail-iy0-f172.google.com (mail-iy0-f172.google.com [209.85.210.172]) by mx.google.com with ESMTPS id g17sm194501vbv.12.2011.02.10.17.09.33 (version=SSLv3 cipher=OTHER); Thu, 10 Feb 2011 17:09:33 -0800 (PST)
Received: by iym1 with SMTP id 1so2060711iym.31 for <http-state@ietf.org>; Thu, 10 Feb 2011 17:09:32 -0800 (PST)
Received: by 10.231.37.200 with SMTP id y8mr7762245ibd.105.1297386572456; Thu, 10 Feb 2011 17:09:32 -0800 (PST)
MIME-Version: 1.0
Received: by 10.231.215.67 with HTTP; Thu, 10 Feb 2011 17:09:02 -0800 (PST)
In-Reply-To: <4D5489E9.10001@stpeter.im>
References: <20110204184735.26023.qmail@mm01.prod.mesa1.secureserver.net> <AANLkTi=qBVkGwMHqAidtwP5_A8pPrF-Y9MV4jgYS5_QM@mail.gmail.com> <7384878F-C44A-42A4-9694-1BB1C18AA5E6@gbiv.com> <AANLkTinFq7bE_e3SSgdjuFvZ8hGn1xy4Hc1VKwc=vp1D@mail.gmail.com> <4D5489E9.10001@stpeter.im>
From: Adam Barth <ietf@adambarth.com>
Date: Thu, 10 Feb 2011 17:09:02 -0800
Message-ID: <AANLkTimSA3gPV7e3hUr-dB5-SPt+SXrb5qShGE-2A3Qw@mail.gmail.com>
To: Peter Saint-Andre <stpeter@stpeter.im>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: http-state@ietf.org
Subject: Re: [http-state] Is this an omission in the parser rules of draft-ietf-httpstate-cookie-21?
X-BeenThere: http-state@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Discuss HTTP State Management Mechanism <http-state.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/http-state>, <mailto:http-state-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/http-state>
List-Post: <mailto:http-state@ietf.org>
List-Help: <mailto:http-state-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/http-state>, <mailto:http-state-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 11 Feb 2011 01:09:23 -0000

On Thu, Feb 10, 2011 at 4:59 PM, Peter Saint-Andre <stpeter@stpeter.im>; wrote:
> On 2/4/11 12:29 PM, Adam Barth wrote:
>> On Fri, Feb 4, 2011 at 11:24 AM, Roy T. Fielding <fielding@gbiv.com>; wrote:
>>> On Feb 4, 2011, at 10:51 AM, Adam Barth wrote:
>>>> On Fri, Feb 4, 2011 at 10:47 AM, Remy Lebeau <remy@lebeausoftware.org>; wrote:
>>>>> -------- Original Message --------
>>>>> Subject: Re: [http-state] Is this an omission in the parser rules of
>>>>> draft-ietf-httpstate-cookie-21?
>>>>> From: Adam Barth
>>>>> Date: Fri, February 04, 2011 10:19 am
>>>>> To: Remy Lebeau
>>>>> Cc: http-state@ietf.org
>>>>>
>>>>>> The draft gives user agents precise
>>>>>> instructions for how to parse all
>>>>>> manner of cookies, including cookies with
>>>>>> values that contain quote characters. That
>>>>>> information is contained in Section 5
>>>>>
>>>>> I have re-read Section 5 and I do not see its grammar or parsing rules
>>>>> accounting for quoted-string values at all. It only says to remove WSP
>>>>> characters surrounding extracted names and values, and quote characters
>>>>> are not part of the WSP definition. So what am I missing? Where exactly
>>>>> does it say how to unquote a quoted-string used in attribute values?
>>>>
>>>> Precisely.  It does not say to unquote a quoted-string because that's
>>>> not how cookies work.  The role of the quote character is cookies is
>>>> identical to the role of the "!" character.  That is, neither play a
>>>> special role in the protocol.  Any representations by the contrary by
>>>> 2109 or any other document are fiction and have only caused pain and
>>>> misery in the world.
>>>
>>> That may be, but the grammar for server generation of set-cookie
>>> values is clearly wrong because use of DQUOTE in cookie values is
>>> common (roughly 10% of the values in my browser cookie store) and
>>> previously defined, even if we consider DQUOTE to be part of the
>>> value string.  Let's just change the generating grammar for value to
>>> match how cookies are actually parsed and only exclude characters
>>> that are known to cause failures.
>>
>> The grammar is not used for parsing.  Parsing is defined in Section 5,
>> not Section 4.
>
> Right. And I think the revised text in version -21 (with revisions to
> address the IESG comment from Robert Sparks) makes that fairly clear.
>
> Adam, did you propose specific text addressing Dan Winship's original
> issue about "cookie-value=token"? As far as I can see, that's the only
> substantive issue raised in this thread, but I admit that I might have
> missed something.

Sure:

diff --git a/drafts/cookie.xml b/drafts/cookie.xml
index e0a53f3..17cc0a5 100644
--- a/drafts/cookie.xml
+++ b/drafts/cookie.xml
@@ -335,7 +335,8 @@ set-cookie-header = "Set-Cookie:" SP set-cookie-string
 set-cookie-string = cookie-pair *( ";" SP cookie-av )
 cookie-pair       = cookie-name "=" cookie-value
 cookie-name       = token
-cookie-value      = token / ""
+cookie-value      = token / *base64-character
+base64-character  = ALPHA / DIGIT / "+" / "/" / "="
 token             = <token, defined in [RFC2616], Section 2.2>

 cookie-av         = expires-av / max-age-av / domain-av /
@@ -370,7 +371,7 @@ extension-av      = <any CHAR except CTLs or ";">

           <t>To maximize compatibility with user agents, servers that wish to
           store arbitrary data in a cookie-value SHOULD encode that data, for
-          example, using Base 16 <xref target="RFC4648" />.</t>
+          example, using Base64 <xref target="RFC4648" />.</t>

           <t>The portions of the set-cookie-string produced by the cookie-av
           term are known as attributes.  To maximize compatibility with user

Adam