[squid-users] from 2.5.STABLE4 on, read_timout sets the object age in case of i gnoring no-cache???

From: <Thorsten.Grote@dont-contact.us>
Date: Thu, 8 Apr 2004 16:43:49 +0200

Hi!

While the attached ignore-no-cache (from servers) patch worked for
2.5.STABLE3 (and lower), it behaves strange in 2.5.STABLE4 and 2.5.STABLE5
(yes, i know: that's against the RFC, but this is only for a backend use in
this case).
When the patch is applied against 2.5.STABLE3, everything works as aspected.
When using this patch in 2.5.STABLE4/5, the age of each object is covered by
the time set for "read_timout". E.g. If read_timout is 5 seconds, the object
will be considered fresh for 5 seconds and than expire... kind of strange
for me. After playing around with the code for some time, i gave up and now
pleasing for help. Maybe someone can help out.

Happy Eastern to all of you ;)
/thorsten

Common subdirectories: src_orig/auth and src_patched/auth
diff -u src_orig/cache_cf.c src_patched/cache_cf.c
--- src_orig/cache_cf.c Thu Feb 6 06:01:07 2003
+++ src_patched/cache_cf.c Fri Aug 15 10:53:32 2003
@@ -1797,6 +1797,8 @@
            storeAppendPrintf(entry, " reload-into-ims");
        if (head->flags.ignore_reload)
            storeAppendPrintf(entry, " ignore-reload");
+ if (head->flags.ignore_no_cache)
+ storeAppendPrintf(entry, " ignore-no-cache");
 #endif
        storeAppendPrintf(entry, "\n");
        head = head->next;
@@ -1816,6 +1818,7 @@
     int override_lastmod = 0;
     int reload_into_ims = 0;
     int ignore_reload = 0;
+ int ignore_no_cache = 0;
 #endif
     int i;
     refresh_t *t;
@@ -1847,6 +1850,8 @@
            override_expire = 1;
        else if (!strcmp(token, "override-lastmod"))
            override_lastmod = 1;
+ else if (!strcmp(token, "ignore-no-cache"))
+ ignore_no_cache = 1;
        else if (!strcmp(token, "reload-into-ims")) {
            reload_into_ims = 1;
            refresh_nocache_hack = 1;
@@ -1888,6 +1893,8 @@
        t->flags.reload_into_ims = 1;
     if (ignore_reload)
        t->flags.ignore_reload = 1;
+ if (ignore_no_cache)
+ t->flags.ignore_no_cache = 1;
 #endif
     t->next = NULL;
     while (*head)
Only in src_patched: cache_cf.c.orig
diff -u src_orig/cf.data.pre src_patched/cf.data.pre
--- src_orig/cf.data.pre Wed May 21 16:34:38 2003
+++ src_patched/cf.data.pre Fri Aug 15 10:53:32 2003
@@ -1592,6 +1592,7 @@
                 override-lastmod
                 reload-into-ims
                 ignore-reload
+ ignore-no-cache

                override-expire enforces min age even if the server
                sent a Expires: header. Doing this VIOLATES the HTTP
@@ -1611,6 +1612,11 @@
                this feature could make you liable for problems which
                it causes.

+ ignore-no-cache ignores any ``Pragma: no-cache'' header
+ received from a server. The HTTP RFC never allows the
+ use of this header from a server, only a client, though
+ plenty of servers send it anyway.
+
        Basically a cached object is:

                FRESH if expires < now, else STALE
Only in src_patched: cf.data.pre.orig
Common subdirectories: src_orig/fs and src_patched/fs
diff -u src_orig/http.c src_patched/http.c
--- src_orig/http.c Sun May 11 19:30:13 2003
+++ src_patched/http.c Fri Aug 15 10:55:56 2003
@@ -222,8 +222,10 @@
     const char *v;
     if (EBIT_TEST(cc_mask, CC_PRIVATE))
        return 0;
- if (EBIT_TEST(cc_mask, CC_NO_CACHE))
- return 0;
+ if (EBIT_TEST(cc_mask, CC_NO_CACHE)) {
+ const refresh_t *R = refreshLimits(httpState->entry->mem_obj->url);
+ if (R && !R->flags.ignore_no_cache) return 0;
+ }
     if (EBIT_TEST(cc_mask, CC_NO_STORE))
        return 0;
     if (httpState->request->flags.auth) {
@@ -241,8 +243,10 @@
        String s = httpHeaderGetList(hdr, HDR_PRAGMA);
        const int no_cache = strListIsMember(&s, "no-cache", ',');
        stringClean(&s);
- if (no_cache)
- return 0;
+ if (no_cache) {
+ const refresh_t *R =
refreshLimits(httpState->entry->mem_obj->url);
+ if (R && !R->flags.ignore_no_cache) return 0;
+ }
     }
     /*
      * The "multipart/x-mixed-replace" content type is used for
Only in src_patched: http.c.orig
diff -u src_orig/protos.h src_patched/protos.h
--- src_orig/protos.h Tue May 6 22:13:02 2003
+++ src_patched/protos.h Fri Aug 15 10:53:32 2003
@@ -784,6 +784,7 @@
 extern int refreshCheckDigest(const StoreEntry *, time_t delta);
 extern time_t getMaxAge(const char *url);
 extern void refreshInit(void);
+extern const refresh_t *refreshLimits(const char *url);

 extern void serverConnectionsClose(void);
 extern void shut_down(int);
Only in src_patched: protos.h.orig
diff -u src_orig/refresh.c src_patched/refresh.c
--- src_orig/refresh.c Thu Jul 18 11:22:17 2002
+++ src_patched/refresh.c Fri Aug 15 10:53:32 2003
@@ -99,14 +99,13 @@
 #define REFRESH_DEFAULT_PCT 0.20
 #define REFRESH_DEFAULT_MAX (time_t)259200

-static const refresh_t *refreshLimits(const char *);
 static const refresh_t *refreshUncompiledPattern(const char *);
 static OBJH refreshStats;
 static int refreshStaleness(const StoreEntry *, time_t, time_t, const
refresh_t *, stale_flags *);

 static refresh_t DefaultRefresh;

-static const refresh_t *
+const refresh_t *
 refreshLimits(const char *url)
 {
     const refresh_t *R;
Common subdirectories: src_orig/repl and src_patched/repl
diff -u src_orig/structs.h src_patched/structs.h
--- src_orig/structs.h Sun May 11 00:17:44 2003
+++ src_patched/structs.h Fri Aug 15 10:53:32 2003
@@ -1684,6 +1684,7 @@
        unsigned int override_lastmod:1;
        unsigned int reload_into_ims:1;
        unsigned int ignore_reload:1;
+ unsigned int ignore_no_cache:1;
 #endif
     } flags;
 };
Only in src_patched: structs.h.orig
Received on Thu Apr 08 2004 - 08:44:07 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Apr 30 2004 - 12:00:02 MDT