]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Henrik Nordstrom <henrik@henriknordstrom.net>
authorrousskov <>
Wed, 1 Aug 2007 10:36:47 +0000 (10:36 +0000)
committerrousskov <>
Wed, 1 Aug 2007 10:36:47 +0000 (10:36 +0000)
Bug #1872: Date parsing error causing HTTP objects to get unexpectedly cached
and fresh ICAP OPTIONS rejected.

Applied Henrik's patch from Squid2 patchset #11161. The bug was affecting ICAP
Options TTLs, marking some ICAP services with soon-to-expire options as being
down. Original patch text is below.

An unexpected and undesired sideeffect of the earlier change to accept dates
far in the future was that the date calculations suddenly got daylight savings
sensitive due to mktime() automatically adjusting the supplied date. This has the
unfortunate effect that if Squid is running in a timezone with daylight savings
things may get cached longer than they should.

lib/rfc1123.c

index eb26f7be83e822f32b60cbabdd66f6698816e32e..e812a1f856c75034d0094485c2df923152a74296 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: rfc1123.c,v 1.39 2006/12/24 15:29:43 serassio Exp $
+ * $Id: rfc1123.c,v 1.40 2007/08/01 04:36:47 rousskov Exp $
  *
  * DEBUG: 
  * AUTHOR: Harvest Derived
@@ -117,7 +117,7 @@ tmSaneValues(struct tm *tm)
        return 0;
     if (tm->tm_mon < 0 || tm->tm_mon > 11)
        return 0;
-    return mktime(tm) != -1;
+    return 1;
 }
 
 static struct tm *
@@ -213,14 +213,14 @@ parse_rfc1123(const char *str)
     t = timegm(tm);
 #elif HAVE_TM_TM_GMTOFF
     t = mktime(tm);
-    {
+    if (t != -1) {
        struct tm *local = localtime(&t);
        t += local->tm_gmtoff;
     }
 #else
     /* some systems do not have tm_gmtoff so we fake it */
     t = mktime(tm);
-    {
+    if (t != -1) {
        time_t dst = 0;
 #if defined (_TIMEZONE)
 #elif defined (_timezone)