Re: [http-state] Ticket 5: Cookie ordering

"Yngve Nysaeter Pettersen" <> Mon, 08 February 2010 16:18 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 3653428C125 for <>; Mon, 8 Feb 2010 08:18:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -6.524
X-Spam-Status: No, score=-6.524 tagged_above=-999 required=5 tests=[AWL=0.075, BAYES_00=-2.599, RCVD_IN_DNSWL_MED=-4]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id Y5CSHQ0HlkA2 for <>; Mon, 8 Feb 2010 08:18:17 -0800 (PST)
Received: from ( []) by (Postfix) with ESMTP id BEFBF28C124 for <>; Mon, 8 Feb 2010 08:18:16 -0800 (PST)
Received: from killashandra.oslo.osa ( []) by (8.14.3/8.14.3/Debian-5) with ESMTP id o18GFLVq002203 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 8 Feb 2010 16:15:21 GMT
Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes
To: "Daniel Stenberg" <>
References: <> <op.u7mkruzjvqd7e2@killashandra.oslo.osa> <> <op.u7nnk8uyvqd7e2@killashandra.oslo.osa>
Date: Mon, 08 Feb 2010 17:19:07 +0100
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
From: "Yngve Nysaeter Pettersen" <>
Organization: Opera Software
Message-ID: <op.u7tgx5y4vqd7e2@killashandra.oslo.osa>
In-Reply-To: <op.u7nnk8uyvqd7e2@killashandra.oslo.osa>
User-Agent: Opera Mail/10.10 (Win32)
Cc: http-state <>
Subject: Re: [http-state] Ticket 5: Cookie ordering
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Discuss HTTP State Management Mechanism <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Mon, 08 Feb 2010 16:18:18 -0000

On Fri, 05 Feb 2010 13:56:58 +0100, Yngve Nysaeter Pettersen  
<> wrote:
> IOW, if ordering is determined by anything but the domain and path the  
> sequence of cookie is going to vary depending on which servers the  
> clients visits and the sequence it visits them, and this might cause  
> significant problems for a server that considers ordering significant.

Some testing by a couple of my colleagues setting two cookies with the  
same name (and path) "host-only" and "domain-wide" have found the  
following in browsers other than Opera:

Visit order: Host-only, domain-wide
Cookie order:  "host-only", "domain-wide"

Visit order: domain-wide, Host-only
Cookie order (IE):  "host-only", "domain-wide"
Cookie order (Others): "domain-wide", "host-only"

To me it looks like IE is sorting by domain, at the same path level, with  
FF and Safari (the two tested) sort on creation data.

The consequence is that there is apparently three deployed ways to send  

    - Cookies at the same path level are grouped and sorted by creation  
date, earliest first (FF&co)
    - Cookies at the same path level are grouped and sorted by domain, most  
specific first (IE)
    - Cookies are grouped by domain (most specific first), then sorted by  
path (most specific first) within each domain (Opera)

IMO the creation date method is less predictable than the other two, and  
will cause problems for sites depending on a specific sequence of cookies.

My suggestion would be that the spec should recommend ordering an ordering  
based on on both domain and path (order of preference to be decided), as  
that will be more predictable for sites using multiple cookies with the  
same name at various domain and path levels.

Yngve N. Pettersen
Senior Developer		     Email:
Opera Software ASA         
Phone:  +47 24 16 42 60              Fax:    +47 24 16 40 01