From: Amos Jeffries Date: Wed, 8 Jul 2009 04:58:09 +0000 (+1200) Subject: Bug 2706: pt 1: don't assert on cosmetic Date: addition for bad timestamps X-Git-Tag: SQUID_3_2_0_1~907 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0dedeb59301205eada38c3e2bebeaa42dd31f82;p=thirdparty%2Fsquid.git Bug 2706: pt 1: don't assert on cosmetic Date: addition for bad timestamps Seems not all StoreEntry are being created with timestamps. This handles them cleanly with a log WARNING when such are sighted instead of asserting --- diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index ae0ec8eeef..b5f620b06b 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -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 */