Re: [http-state] non-ASCII cookie values (was Re: Closing Ticket 3: Public Suffixes)

David Morris <dwm@xpasc.com> Tue, 02 February 2010 05:06 UTC

Return-Path: <dwm@xpasc.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 7E58728C212 for <http-state@core3.amsl.com>; Mon, 1 Feb 2010 21:06:52 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.307
X-Spam-Level:
X-Spam-Status: No, score=-1.307 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, MISSING_HEADERS=1.292]
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 J8H2NmVbTKK4 for <http-state@core3.amsl.com>; Mon, 1 Feb 2010 21:06:51 -0800 (PST)
Received: from mail.xpasc.com (mail.xpasc.com [68.164.244.189]) by core3.amsl.com (Postfix) with ESMTP id 9756628C20F for <http-state@ietf.org>; Mon, 1 Feb 2010 21:06:51 -0800 (PST)
Received: from bslepgate.xpasc.com (localhost.localdomain [127.0.0.1]) by bslepgate.xpasc.com (Postfix-out) with ESMTP id F23F4101842 for <http-state@ietf.org>; Mon, 1 Feb 2010 21:07:28 -0800 (PST)
X-Propel-Return-Path: <dwm@xpasc.com>
Received: from mail.xpasc.com ([10.1.2.88]) by [127.0.0.1] ([127.0.0.1]) (port 7027) (Abaca EPG outproxy filter 3.1.1.9347 $Rev: 9262 $) id iz6Ura2257s0; Mon, 01 Feb 2010 21:07:28 -0800
Received: from xpasc.com (egate.xpasc.com [10.1.2.49]) by bslepgate.xpasc.com (Postfix-out) with ESMTP id CF4DF10183C for <http-state@ietf.org>; Mon, 1 Feb 2010 21:07:28 -0800 (PST)
Received: from egate.xpasc.com (egate.xpasc.com [10.1.2.49]) by xpasc.com (8.13.8/8.13.8) with ESMTP id o1257SHc007771 for <http-state@ietf.org>; Mon, 1 Feb 2010 21:07:28 -0800
Date: Mon, 01 Feb 2010 21:07:28 -0800
From: David Morris <dwm@xpasc.com>
cc: http-state@ietf.org
In-Reply-To: <E1E6C8DE-EFB6-4226-93EE-AF20053FF315@apple.com>
Message-ID: <Pine.LNX.4.64.1002012105180.6765@egate.xpasc.com>
References: <7789133a1002011014x5d587436j663a73bc92270a65@mail.gmail.com> <E1E6C8DE-EFB6-4226-93EE-AF20053FF315@apple.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset="US-ASCII"
X-Propel-ID: iz6Ura2257s0
Subject: Re: [http-state] non-ASCII cookie values (was Re: Closing Ticket 3: Public Suffixes)
X-BeenThere: http-state@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: http-state@ietf.org
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: Tue, 02 Feb 2010 05:06:52 -0000

On Mon, 1 Feb 2010, Maciej Stachowiak wrote:

> 
> On Feb 1, 2010, at 10:14 AM, Adam Barth wrote:
> 
> > On Sun, Jan 31, 2010 at 2:37 PM, eric bianchetti
> > <eric_bianchetti@yahoo.com> wrote:
> >> That part does not please :
> >> 
> >> The cookie-value is opaque to the user agent and MAY be anything the
> >>    origin server chooses to send, possibly in a server-selected
> >>    printable ASCII encoding.
> >> 
> >> Livng and working in a non ASCII country, I tend to think we shall prepare for the coming of the other languages (Thai, Chines, Korean ....), IF a person get a cookie from a Thai server , can we securely suppose that person(computer) went to a thai site, and that person is using Thai on a daily basis? (Replace Thai by any multi bytes languages).
> > 
> > The part of that sentence after the "possibly" doesn't haven any
> > normative force (it's just advice that the server can take or leave).
> > I can remove the reference to ASCII here if you like.  Julian please
> > correct me if I'm wrong, but I believe that HTTP headers typically
> > contain only ASCII characters.
> 
> We do have to define what happens if there are non-ASCII characters in a header value. Presumably, if such bytes are set via Set-Cookie, then the Cookie header just echoes them back, so we can treat them as opaque. (That's assuming there is no requirement to reject non-ASCII cookie values.) But there are two ways in which it matters:
> 
> 1) A header with non-ASCII bytes get set via Set-Cookie, then read through a JS API such as document.cookie. document.cookie gives a UTF-16 encoded string, so at this point the server has to decide how to interpret non-ASCII bytes in the cookie value.
> 
> 2) If you set a cookie via document.cookie and include non-ASCII characters in the value, what bytes get sent?

Seems to me that the platform providing the document.cookie object is 
responsible for making any value placed in the cookie: header correct.

I think Julian provided a sensible answer for non-ascii characters ... 
certainly for this iteration of document what exists ... unless there 
is a different common behavior to document.