cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1863171 ] curl_getdate() fails to parse UTC +1300

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Sat, 05 Jan 2008 15:33:40 -0800

Bugs item #1863171, was opened at 2008-01-03 08:06
Message generated for change (Comment added) made by johnson1234
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1863171&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: wrong behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jeff Johnson (johnson1234)
Assigned to: Daniel Stenberg (bagder)
Summary: curl_getdate() fails to parse UTC +1300

Initial Comment:
There are areas of New Zealand currently under Daylight Saving Time at UTC +1300. For reference, see for example <http://en.wikipedia.org/wiki/Time_zone>. However, the function curl_getdate() fails to parse these dates, because it has an erroneous, hard-coded limit that only allows values less than +1300. So curl_getdate() returns -1 for "Tue, 01 Jan 2008 00:00:01 +1300" but correctly parses "Tue, 01 Jan 2008 00:00:01 +1200".

This bug still exists as of the daily snapshot on Jan 3, 2008. The problematic code is in the function parsedate() at lib/parsedate.c:292.

        if((tzoff == -1) &&
           ((end - date) == 4) &&
           (val < 1300) &&
           (indate< date) &&
           ((date[-1] == '+' || date[-1] == '-'))) {
          /* four digits and a value less than 1300 and it is preceeded with
             a plus or minus. This is a time zone indication. */
          found = TRUE;
          tzoff = (val/100 * 60 + val%100)*60;

          /* the + and - prefix indicates the local time compared to GMT,
             this we need ther reversed math to get what we want */
          tzoff = date[-1]=='+'?-tzoff:tzoff;
        }

----------------------------------------------------------------------

>Comment By: Jeff Johnson (johnson1234)
Date: 2008-01-05 17:33

Message:
Logged In: YES
user_id=993558
Originator: YES

It should be at least < 1400. An even higher limit might be advisable, to
'future proof' the code. Locales can do crazy things with DST.

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2008-01-05 16:57

Message:
Logged In: YES
user_id=1110
Originator: NO

so a simple <= 1300 will be fine then?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1863171&group_id=976
Received on 2008-01-06

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET