]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2706: pt 1: don't assert on cosmetic Date: addition for bad timestamps
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 10 Jul 2009 00:17:43 +0000 (12:17 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 10 Jul 2009 00:17:43 +0000 (12:17 +1200)
Seems not all StoreEntry are being created with timestamps. This handles
them cleanly with a log WARNING when such are sighted instead of asserting

src/client_side_reply.cc

index ae0ec8eeef4b3d4773c569174648f2f1022246fe..b5f620b06bccd2a0a853a359b64c466c15205e1b 100644 (file)
@@ -1294,10 +1294,14 @@ clientReplyContext::buildReplyHeader()
      * NP: done after Age: to prevent ENTRY_SPECIAL double-handling this header.
      */
     if ( !hdr->has(HDR_DATE) ) {
-        if (http->storeEntry())
-            hdr->insertTime(HDR_DATE, http->storeEntry()->timestamp);
-        else
+        if (!http->storeEntry())
             hdr->insertTime(HDR_DATE, squid_curtime);
+        else if (http->storeEntry()->timestamp > 0)
+            hdr->insertTime(HDR_DATE, http->storeEntry()->timestamp);
+        else {
+            debugs(88,1,"WARNING: An error inside Squid has caused an HTTP reply without Date:. Please report this");
+            /* TODO: dump something useful about the problem */
+        }
     }
 
     /* Filter unproxyable authentication types */