apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxime Petazzoni <maxime.petazz...@bulix.org>
Subject [PATCH] fixing bogus apr_date_parse_rfc()
Date Wed, 03 Aug 2005 18:58:13 GMT

While coding on mod_mbox for my Summer Of Code project, I discovered
a strange malfunction in the sort by date function. I found that the
timezone information in the RFC 2822 [1] date format [2] was not parsed
by apr_date_parse_rfc() [3], the function used by mod_mbox to generate
apr_time_t timestamps, thus making the date sort unreliable.

I took a closer look to the function's code, and found that some index
paddings in the date string were wrong (distance between the begining of
the time and the begining of the timezone is 9, not 8).

I've attached a patch including the fix and a test program. You can
easily get test material with a mbox file :

cd apr-util/test/
grep -h -e "^Date: " ~/file.mbox > data/testdaterfc.input
cat data/testdaterfc.input | ./testdaterfc | less

- Sam

[1] http://ietf.org/rfc/rfc2822.txt - Page 14
[2] For example : Sun, 2 Jul 2005 21:46:37 +0200
[3] From APR-Util : apr-util/misc/apr_date.c

Maxime Petazzoni (http://www.bulix.org)
 -- gone crazy, back soon. leave message.

View raw message