from David Hankins (patch) [dhankins@mercenary.net: squid 1.1.21 patch

From: k claffy <kc@dont-contact.us>
Date: Tue, 23 Jun 1998 15:56:43 -0700

--MimeMultipartBoundary
Content-Type: text/plain; charset=us-ascii

----- Forwarded message from "David W. Hankins" <dhankins@mercenary.net> -----
  Return-Path: dhankins@hcf.mercenary.net
  Received: from nlanr.net (oceana-ether.nlanr.net [192.172.226.25]) by caida.org (8.8.8/8.7.3) with ESMTP id TAA06150 for <kc@ipn.caida.org>; Mon, 22 Jun 1998 19:12:00 -0700 (PDT)
  Received: from hcf.mercenary.net (mail@hcf.mercenary.net [209.122.24.43])
          by nlanr.net (8.8.6/8.8.6) with ESMTP id RAA15821
          for <kc@nlanr.net>; Mon, 22 Jun 1998 17:23:50 -0700 (PDT)
  Received: (from dhankins@localhost)
          by hcf.mercenary.net (8.8.7/8.8.7) id UAA22394;
          Mon, 22 Jun 1998 20:23:47 -0400
  Message-ID: <19980622202346.E21885@mercenary.net>
  Date: Mon, 22 Jun 1998 20:23:46 -0400
  From: "David W. Hankins" <dhankins@mercenary.net>
  To: Kim Claffy <kc@nlanr.net>
  Subject: squid 1.1.21 patch
  Mime-Version: 1.0
  Content-Type: text/plain; charset=us-ascii
  X-Mailer: Mutt 0.91.1i

I highly recommend the following patch.

I am conversable if the comment is unclear.

diff -u ../../squid-1.1.21/src/refresh.c ./refresh.c
--- ../../squid-1.1.21/src/refresh.c Fri Dec 20 18:23:01 1996
+++ ./refresh.c Mon Jun 22 20:16:45 1998
@@ -163,13 +163,45 @@
         debug(22, 3, "refreshCheck: YES: age > max\n");
         return 1;
     }
- if (entry->timestamp <= entry->lastmod) {
+ /* Agree, this is fucked up. Fault it out of the cache. */
+ if (entry->timestamp < entry->lastmod) {
         if (request->protocol != PROTO_HTTP) {
             debug(22, 3, "refreshCheck: NO: non-HTTP request\n");
             return 0;
         }
         debug(22, 3, "refreshCheck: YES: lastvalid <= lastmod\n");
         return 1;
+ }
+ /* Earlier, the above if statment was a <=. This sucked because there
+ * are a set of really stupid httpds (Microsoft-IIS/4.0) which neither
+ * set a 'Last-Modified' header nor do they understand If-Modified-Since.
+ * The resulit is that squid sets the last-modified to squid_curtime,
+ * which is what timestamp is set to. The idea is that we'd refresh a
+ * few times, learn a new timestamp but keep the old last-mod. The
+ * big problem here is that we still *get the object* because this server,
+ * not intelligent enough to provide last-modified, is not intelligent
+ * enough to understand if-modified-since. So the timestamp is never
+ * updated, the object uses disk space and is *never actually cached.*.
+ * This is a perfectly cacheable object...if the remote server is old,
+ * we should use the min/max rules instead of just not caching.
+ *
+ * The alternative to the below is to modify the actual refreshing code
+ * so that we detect when the object is exactly identical to the previous
+ * object; update the timestamp and leave the last-modified stamp. Then
+ * we fall back into the designed exponential-backoff that is the pct.
+ *
+ * BUT...we are still not caching the object by retrieving it. We are
+ * still using network resources.
+ *
+ * So...it is better to use the == here to signal that the remote server
+ * is incapable of participating with us in our grand scheme to provide
+ * exponential backoffs. The lack of a last-modified is the hint that it
+ * doesn't understand if-modified-since.
+ */
+ if( entry->timestamp == entry->lastmod )
+ {
+ debug(22, 3, "refreshCheck: NO: remote server probably incapable\n" );
+ return 0;
     }
     factor = 100 * age / (entry->timestamp - entry->lastmod);
     debug(22, 3, "refreshCheck: factor = %d\n", factor);

-- 
David Hankins,             "If you don't do it right the first time,
Network Mercenary			    you'll just have to do it again."
							-- J.T. Hankins
----- End forwarded message -----
----- End forwarded message -----
--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:51 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:49 MST