curl-library
Re: [PATCH] Use magic expiration value for session cookies
Date: Thu, 3 Sep 2009 17:08:00 +0200
On Sep 3, 2009, at 10:26 AM, Daniel Stenberg wrote:
> I appreciate your effort and what you're trying to do. But I think
> this approach is a bit too strange. I suggest a different approach.
> (I just committed a better date parser API for internal use too. It
> will now allow our code to properly separate parsing errors from
> time overflow or failed to parse etc.)
>
> I suggest we instead store 1970-01-01 00:00:00 as expires at 1, as a
> special case. The date is far away in the past anyway (hey even
> before *I* was born) and it won't matter if 'expires' 1970-01-01
> 00:00:00 and 1970-01-01 00:00:01 will both use 1. This allows us to
> keep 0 reserved for "session cookies" and allows us to save the
> cookies fine in the netscape file format exactly like today.
So, second take on this. As discussed on IRC - if curl_getdate returns
0 when reading expires then explicitly set expires to 1. Much simpler
than magic values =)
Also attached is a corrected version of the test.
/claes
- application/octet-stream attachment: epoch-cookies-support-revised.patch
- application/octet-stream attachment: test565