--------------------- PatchSet 4860 Date: 2002/09/03 10:29:38 Author: rbcollins Branch: rfc2616 Tag: (none) Log: Send warning 113 when appropriate Members: src/client_side.c:1.70.2.1->1.70.2.2 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.70.2.1 retrieving revision 1.70.2.2 diff -u -r1.70.2.1 -r1.70.2.2 --- squid/src/client_side.c 3 Sep 2002 08:31:28 -0000 1.70.2.1 +++ squid/src/client_side.c 3 Sep 2002 10:29:38 -0000 1.70.2.2 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.70.2.1 2002/09/03 08:31:28 rbcollins Exp $ + * $Id: client_side.c,v 1.70.2.2 2002/09/03 10:29:38 rbcollins Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1211,9 +1211,25 @@ (void) 0; else if (http->entry->timestamp < 0) (void) 0; - else if (http->entry->timestamp < squid_curtime) + else if (http->entry->timestamp < squid_curtime) { httpHeaderPutInt(hdr, HDR_AGE, squid_curtime - http->entry->timestamp); + /* Signal old objects. NB: rfc 2616 is not clear, by implication, on + * whether we should do this to all responses, or only cache hits. + * 14.46 states it ONLY applys for heuristically caclulated + * freshness values, 13.2.4 doesn't specify the same limitation. + * We interpret RFC 2616 under the combination. + */ + /* TODO: if maxage or s-maxage is present, don't do this + */ + if (squid_curtime - http->entry->timestamp >= 86400) { + char tempbuf[512]; + snprintf (tempbuf, sizeof(tempbuf), "%s %s %s", "113", ThisCache, + "This cache hit is still fresh and more than 1 day old"); + httpHeaderPutStr(hdr, HDR_WARNING, tempbuf); + } + } + } /* Handle authentication headers */ if (request->auth_user_request)