fix timezone processing in libvarnish

Jammy jammy.linux at gmail.com
Wed Jun 6 09:35:36 CEST 2012


These days, we met with some Expire headers with following format which are not supported by varnish yet.
Sun, 06 Nov 1994 08:49:37 +0000

Also it seems that strptime was broken dealing with %z & %Z, so 
I create the patch to support timezone spec defined in http://www.ietf.org/rfc/rfc822.txt

zone = "UT" / "GMT" ; Universal Time
; North American : UT
/ "EST" / "EDT" ; Eastern: - 5/ - 4
/ "CST" / "CDT" ; Central: - 6/ - 5
/ "MST" / "MDT" ; Mountain: - 7/ - 6
/ "PST" / "PDT" ; Pacific: - 8/ - 7
/ 1ALPHA ; Military: Z = UT;
; A:-1; (J not used)
; M:-12; N:+1; Y:+12
/ ( ("+" / "-") 4DIGIT ) ; Local differential
; hours+min. (HHMM)


1ALPHA format is easy to add, too, but I think it might not be used widely, so I leave it unsupported with performance consideration.

Test cases:
+	tst("Sunday, 06-Nov-94 08:49:37 CST", 784090177);
+	tst("Sunday, 06-Nov-94 08:49:37 PST", 784082977);
+	tst("Sun, 06 Nov 1994 08:49:37 +0000", 784111777);
+	tst("Sun, 06 Nov 1994 08:49:37 -0000", 784111777);
+	tst("Sun, 06 Nov 1994 08:49:37 +0100",784115377);
+	tst("Sun, 06 Nov 1994 08:49:37 -0100",784108177);
+	tst("Sun, 06 Nov 1994 08:49:37 +0010", 784112377);
+	tst("Sun, 06 Nov 1994 08:49:37 -0010", 784111177);



Please review the change, thanks

----------------------------------
Best wishes,
Jammy






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20120606/c675258d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-timezone-process.patch
Type: application/octet-stream
Size: 4851 bytes
Desc: not available
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20120606/c675258d/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20120606/c675258d/attachment-0001.html>


More information about the varnish-dev mailing list