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: Sun, 06 Jan 2008 02:52:21 -0800

Bugs item #1863171, was opened at 2008-01-03 15:06
Message generated for change (Comment added) made by bagder
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: Closed
>Resolution: Fixed
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: Daniel Stenberg (bagder)
Date: 2008-01-06 11:52

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

Thanks a lot for your report and feedback, I committed a fix that now
accepts -1400 to +1400 offsets, as I found a resource on the net that
mentioned them being delimiters a time zone parser should expect, so until
we find something that indicates even larger offsets I think these will be
fine.

Case closed!

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

Comment By: Jeff Johnson (johnson1234)
Date: 2008-01-06 00: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 23: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