From: rousskov <> Date: Wed, 1 Aug 2007 10:36:47 +0000 (+0000) Subject: Author: Henrik Nordstrom X-Git-Tag: SQUID_3_0_PRE7~139 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=737e901b9d99f9dcf772c42b4daf56fa7f404077;p=thirdparty%2Fsquid.git Author: Henrik Nordstrom 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. --- diff --git a/lib/rfc1123.c b/lib/rfc1123.c index eb26f7be83..e812a1f856 100644 --- a/lib/rfc1123.c +++ b/lib/rfc1123.c @@ -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)