cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: http-state and cookie order

From: Claes Jakobsson <claes_at_versed.se>
Date: Tue, 13 Apr 2010 08:43:13 +0200

On 12 apr 2010, at 14.16, Daniel Stenberg wrote:
> The biggest problem we get with this, is that the sorting uses "creation time" of the cookies. libcurl and curl and others mostly use the netscape cookie files to store cookies and keep state between invokes, and that file format doesn't include creation time info! It is a simple text-based file format with TAB-separated columns and the last (7th) column is the cookie's content.
>
> In order to support the correct sorting between sessions, we need to invent a way to pass on the creation time. My thinking is that we do this in a way that allows older libcurls still understand the file but just not see/understand the creation time, while newer versions will be able to get it. This would be possible by extending the 'expires' field (the 6th) as it is a numerical value that the existing code will parse as a number and it will stop at the first non-digit character. We could easily add a character separation and store the creation time after. Like:
>
> Old expire time:
>
> 2345678
>
> New expire+creation time:
>
> 2345678/1234567

Another way we could store this is as a comment line with some formating following or preceding the cookie, for example

.mozilla.com TRUE / FALSE 1281168255 __utmz 183859642.1265400256.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
# Create time: 1281168000

These comments will simply be ignored by other implementations and older curl. And if we don't see a creating time comment, well.. then I suppose epoch will do. It's a tiny bit more work than using a separation character but it's less likely to cause any compat issues.

Cheers,
Claes

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-13