Hello.

I am using Squid 3.0.STABLE8 on Debian Linux.

# echo "Some useful content.">/var/www/a
# touch -t200807241400 /var/www/a
#

$ http_proxy=localhost:3128 curl \
> -H "Pragma:" \
> -H "Cache-Control: max-age=0" \
> -H "If-Modified-Since: Wed, 23-Jul-08 12:00:00 GMT" \
> http://localhost/a
Some useful content.
$ http_proxy=localhost:3128 curl \
> -H "Pragma:" \
> -H "Cache-Control: max-age=0" \
> -H "If-Modified-Since: Wed, 23-Jul-08 12:00:00 GMT" \
> http://localhost/a
$

The first time, the cache get filled.

The second time, I get a 304 HTTP response.
This answer is not correct.
The document has changed since the date specified.

With the "Cache-Control: max-age=0" header,
Squid is asked to validate its entry.
It contacts the origin server with its own If-Modified-Since header.
The origin server responds 304.
Squid forwards this response to the client.
It should not.
Squid and client If-Modified-Since headers are different.

How about this patch?

--- client_side_reply.cc    2008-07-25 20:00:02.000000000 +0200
+++ client_side_reply.cc    2008-07-25 20:05:17.000000000 +0200
@@ -1,5 +1,5 @@
 /*
- * $Id: client_side_reply.cc,v 1.154 2008/02/16 17:42:27 rousskov Exp $
+ * $Id$
  *
  * DEBUG: section 88    Client-side Reply Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -370,7 +370,7 @@

     // if client sent IMS

-    if (http->request->flags.ims) {
+ if (http->request->flags.ims && http->request->ims > http->request->lastmod) {
         // forward the 304 from origin
debugs(88, 3, "handleIMSReply: origin replied 304, revalidating existing entry and forwarding 304 to client");
         sendClientUpstreamResponse();

Reply via email to