cURL / Mailing Lists / curl-library / Single Mail

curl-library

7.18.2: Possible bug in converting a cookie's expires attribute to unix timestamp ?

From: Stefan Krause <stefan.krause_at_gmx.net>
Date: Wed, 03 Sep 2008 21:47:44 +0200

Hello friends of libCurl,

libCurl 7.18.2 was used. I set a cookie with an expiration date <= Thu,
01-Jan-1970 00:59:59 GMT.
That is converted to -1 (should be 3599, or ?). libCurl internally
handles that cookie as session cookies, because
the expires value <= 0 and sends it to the server next time (despite it
is expired !).

See here the conversion:

Added cookie TEST="1234" for domain localhost, path /, expire -1
Set-Cookie: TEST=1234; expires=Thu, 01-Jan-1970 00:59:59 GMT; path=/

Expiration date Thu, 01-Jan-1970 01:00:00 GMT is converted to 1, but
should be 3600 !?.
Here it is not as bad as above because that cookie is not treated as
session cookie. It is
correctly detected to be expired.

The affected function is:

Files:
$Id: cookie.c,v 1.87 2008-01-31 12:21:57 bagder Exp $
line 349: co->expires = curl_getdate(what, &now);

Whats your opinion ?

Thanks and best regards,
 
    Stefan
Received on 2008-09-03