Re: Is Expires fix on hem.passagen.se in 1.1.22? [updated patch]

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 11 Jul 1998 17:54:01 +0200

Michael Fuhr wrote:
> However it's done, I hope the ability to override Expires: will
> remain. Banner ads come to mind.

Ok. Patch is now extended to include the ability to selectively override
Expires: by extending refresh_pattern with the "override-expires" option
(see squid.conf after applying the patch).

Full freshness algorithm with this patch:

  STALE if age > request max age (Cache-Control in request)
  FRESH if age < forced min age
  STALE/FRESH based on Expires if available
  FRESH if age < min
  STALE if age > max
  STALE if changed in the future (HTTP only)
  FRESH if age < last-modified-age * factor
  STALE otherwise

---
Henrik Nordstrom
Sparetime Squid Hacker

--- squid-1.1.22/src/cache_cf.c.dist Sat Jul 11 17:28:13 1998
+++ squid-1.1.22/src/cache_cf.c Sat Jul 11 17:31:57 1998
@@ -599,6 +599,14 @@
     pct = i;
     GetInteger(i); /* token: max */
     max = (time_t) (i * 60); /* convert minutes to seconds */
+ while((token = strtok(NULL, w_space))) { /* token: options */
+ if (!strcmp(token,"override-expire")) {
+ min=-min; /* XXX: This is a cludge... */
+ } else {
+ debug(3, 0, "parseRefreshPattern: token='%s'\n", token);
+ self_destruct();
+ }
+ }
     refreshAddToList(pattern, icase, min, pct, max);
     safe_free(pattern);
 }
--- squid-1.1.22/src/refresh.c.dist Sat Dec 21 00:23:01 1996
+++ squid-1.1.22/src/refresh.c Sat Jul 11 16:49:41 1998
@@ -146,8 +146,8 @@
             return 1;
         }
     }
- if (age <= min) {
- debug(22, 3, "refreshCheck: NO: age < min\n");
+ if (min < 0 && age <= -min) {
+ debug(22, 3, "refreshCheck: NO: age < forced min\n");
         return 0;
     }
     if (-1 < entry->expires) {
@@ -158,6 +158,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-1.1.22/src/squid.conf.pre.in.dist Sat May 2 01:21:03 1998
+++ squid-1.1.22/src/squid.conf.pre.in Sat Jul 11 17:08:01 1998
@@ -621,17 +621,22 @@
 # TAG: refresh_pattern # case sensitive
 # TAG: refresh_pattern/i # case insensitive
 #
-# usage: refresh_pattern regex min percent max
+# usage: refresh_pattern regex min percent max [options]
 #
 # min and max are specified in MINUTES.
 # percent is an integer number.
 #
+# options: override-expire
+#
+# override-expire enforces min age even when Expires is set.
+# Varning: this violates the HTTP protocol, use with caution.
+#
 # Please see the file doc/Release-Notes-1.1.txt for a full
 # 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 Jul 11 1998 - 08:56:35 MDT

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