Re: Why is Dilbert cached? (caching past expires) [patch]

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 20 Jun 1998 02:04:16 +0200

Andrew Leahy wrote:

> 2. Allow greater control over the 'object refresh' logic. Say,
> by adding extra options to the "refresh_pattern" settings.
> Being able to force the "Expires:" header to be checked before
> "min age". I dunno, something like:

Not obeying a Expires: header is a HTTP violation, and should be fixed.

I have attached a small patch that changes the logic to

       STALE if expires < now
       FRESH if age < min
       STALE if age > max
       FRESH if lm-factor < percent

Expires is only checked if set by the server.

The min age is still useful on objects where the server has not set a
expiry time.

Because of the sad state of the WWW of today I understand some sites may
be required to override the expiry time send by certain servers, but it
has to be done in a more clever way than Squid currently does (and after
this patch it doesn't override Expires:).

I leave the implementation of Expires: override to the one that needs
it.
Requirements:
1. It should only be done when explicitly enabled in squid.conf,
preferably by a extra keyword on refresh_pattern, for example
override-expire
2. The Expires: header needs to be rewritten to reflect the overridden
time.
3. When overriding Expires: a Warning: 99 header should be added that
tells that the Expires: header is rewritten, and preferably what the
original time was.

A alternative to 2 & 3 is to add a "Warning: 10 squid-host:port
below%20min%20age" header when the object is stale but below the min
age. Unfortunately this won't help client caches.

Don't hesitate to mail me if you need any help on Squid internals.

---
Henrik Nordström
Sparetime Squid Hacker

--- refresh.c.orig Sat Jun 20 01:11:42 1998
+++ refresh.c Sat Jun 20 01:11:52 1998
@@ -146,10 +146,6 @@
             return 1;
         }
     }
- if (age <= min) {
- debug(22, 3, "refreshCheck: NO: age < min\n");
- return 0;
- }
     if (-1 < entry->expires) {
         if (entry->expires <= check_time) {
             debug(22, 3, "refreshCheck: YES: expires <= curtime\n");
@@ -158,6 +154,10 @@
             debug(22, 3, "refreshCheck: NO: expires > curtime\n");
             return 0;
         }
+ }
+ if (age <= min) {
+ debug(22, 3, "refreshCheck: NO: age < min\n");
+ return 0;
     }
     if (age > max) {
         debug(22, 3, "refreshCheck: YES: age > max\n");
--- squid.conf.pre.in.orig Wed Dec 31 22:36:59 1997
+++ squid.conf.pre.in Sat Jun 20 01:12:57 1998
@@ -615,8 +615,8 @@
 # description of Squid's refresh algorithm. Basically a
 # cached object is:
 #
-# FRESH if age < min
 # STALE if expires < now
+# FRESH if age < min
 # STALE if age > max
 # FRESH if lm-factor < percent
 #
Received on Sat Jun 20 1998 - 04:54:39 MDT

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