OK, here's the patch against apr_date.c distributed with apache 2.0.43.

  - Dmitri.


--- apr_date.c  2002/12/31 21:37:06     1.1.1.1
+++ apr_date.c  2003/03/28 18:02:03     1.4
@@ -341,6 +341,7 @@
  *     Sun, 06 Nov 94 8:49:37 GMT     ; Unknown [Elm 70.85]
  *     Sun, 6 Nov 94 8:49:37 GMT      ; Unknown [Elm 70.85] 
  *     Mon,  7 Jan 2002 07:21:22 GMT  ; Unknown [Postfix]
+ *     Sun, 06-Nov-1994 08:49:37 GMT  ; looks like RFC 1123, but with dashes
  *
  */
 
@@ -563,6 +564,22 @@
         monstr = date + 3;
         timstr = date + 12;
         gmtstr = date + 20;
+
+        TIMEPARSE_STD(ds, timstr);
+    }
+    else if (apr_date_checkmask(date, "[EMAIL PROTECTED] ##:##:## *")) {
+       /* RFC 1123 with dashes instead of spaces between date/month/year */
+        ds.tm_year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100;
+        if (ds.tm_year < 0)
+            return APR_DATE_BAD;
+
+        ds.tm_year += ((date[9] - '0') * 10) + (date[10] - '0');
+
+        ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0');
+
+        monstr = date + 3;
+        timstr = date + 12;
+        gmtstr = date + 21;
 
         TIMEPARSE_STD(ds, timstr);
     }


On Fri, Mar 28, 2003 at 09:35:20AM -0800, Justin Erenkrantz wrote:
> --On Thursday, March 27, 2003 6:20 PM -0500 Dmitri Tikhonov 
> <[EMAIL PROTECTED]> wrote:
> 
> >There are two date-parsing routines in apr-util:
> >
> >     apr_date_parse_rfc
> >     apr_date_parse_http
> >
> >However, I encountered one date format that neither of these functions
> >can parse:
> >
> >     Sat, 26-Mar-2005 23:14:33 GMT
> >
> >It is an expire for cookies generated by InfoPop's forum product.  You can
> >see it in action here:
> >
> >     http://community.infopop.net/2/OpenTopic
> >
> >While this date string does not adhere to standards, I think we should have
> >a function that would be able to parse it.
> 
> Feel free to submit a patch that adds it to apr_date_parse_rfc.  -- justin

Reply via email to