Re: 1.1.21: Obey Expires: in refresh_pattern checks. [patch]

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Fri, 17 Jul 1998 08:24:26 +0200

Duane Wessels wrote:

> I can't apply this until we have a way to let people override
> the expires value.

That is why there is a updated 1.1.22 version of this patch... ;-)
[attached]

> Other thoughts:
>
> * we could log WARNINGS in cache.log for every refresh
> pattern which causes a violation.

Perhaps. But it is not that important. Or enforce that the one who
configures Squid knows what he is doing.

> * The squid.conf comments for refresh_pattern should/could
> be expanded to make it obvious that non-zero MIN value
> violates HTTP.

See the current revision of this patch (which I am going to clean up for
1.2).

> * we should be using the HTTP/1.1 WARNING reply headers.

True.

    [ Part 2: "Attached Text" ]

--- 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 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