Menu

#960 Date Parsing is not RFC 822 compliant

closed-fixed
libcurl (356)
5
2014-10-31
2010-09-27
Matt Ford
No

Tested on Debian Squeeze, Curl version 7.21.0
RFC 822 as I read it shows that seconds are optional when specifying the date format. However when passing a date with a seconds field results in a -1 error. Some RSS feeds I use don't specify the seconds on there publish date. The attached file shows the bad behaviour.

Discussion

  • Matt Ford

    Matt Ford - 2010-09-27
     
  • Matt Ford

    Matt Ford - 2010-09-27

    That should read "passing a date *without* a seconds field". Poor bug reporting that. :-)

     
  • Daniel Stenberg

    Daniel Stenberg - 2010-09-27
    • status: open --> open-fixed
     
  • Daniel Stenberg

    Daniel Stenberg - 2010-09-27

    Ack.

    I've tried with the patch that I'll show here and it seems to work. I'll commit and push this within shortly:

    --- a/lib/parsedate.c
    +++ b/lib/parsedate.c
    @@ -371,6 +371,12 @@ int Curl_parsedate(const char *date, time_t *output)
    /* time stamp! */
    date += 8;
    }
    + else if((secnum == -1) &&
    + (2 == sscanf(date, "%02d:%02d", &hournum, &minnum))) {
    + /* time stamp without seconds */
    + date += 5;
    + secnum = 0;
    + }
    else {
    val = (int)strtol(date, &end, 10);

     
  • Daniel Stenberg

    Daniel Stenberg - 2010-09-27

    Thanks for the report, this problem is now fixed in the git repository.

    To try it out, you either checkout/update your git clone: http://curl.haxx.se/source.html

    or you try tomorrow's daily snapshot: http://curl.haxx.se/snapshots/

     
  • Daniel Stenberg

    Daniel Stenberg - 2010-09-27
    • status: open-fixed --> closed-fixed
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.