]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
DW:
authorwessels <>
Thu, 9 Nov 2000 10:09:47 +0000 (10:09 +0000)
committerwessels <>
Thu, 9 Nov 2000 10:09:47 +0000 (10:09 +0000)
 - Adding max-stale cache-control directive.

src/HttpHdrCc.cc
src/enums.h
src/structs.h

index 80e7d99383ed233f4a078573e8154c8b197dbf9c..ef6836cf4be9e6979c374b1b2419b71d99ed4f43 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpHdrCc.cc,v 1.20 2000/03/06 16:23:27 wessels Exp $
+ * $Id: HttpHdrCc.cc,v 1.21 2000/11/09 03:09:47 wessels Exp $
  *
  * DEBUG: section 65    HTTP Cache Control Header
  * AUTHOR: Alex Rousskov
@@ -48,6 +48,7 @@ static const HttpHeaderFieldAttrs CcAttrs[CC_ENUM_END] =
     {"only-if-cached", CC_ONLY_IF_CACHED},
     {"max-age", CC_MAX_AGE},
     {"s-maxage", CC_S_MAXAGE},
+    {"max-stale", CC_MAX_STALE},
     {"Other,", CC_OTHER}       /* ',' will protect from matches */
 };
 HttpHeaderFieldInfo *CcFieldsInfo = NULL;
@@ -77,7 +78,7 @@ HttpHdrCc *
 httpHdrCcCreate(void)
 {
     HttpHdrCc *cc = memAllocate(MEM_HTTP_HDR_CC);
-    cc->max_age = cc->s_maxage = -1;
+    cc->max_age = cc->s_maxage = cc->max_stale = -1;
     return cc;
 }
 
@@ -140,6 +141,12 @@ httpHdrCcParseInit(HttpHdrCc * cc, const String * str)
                EBIT_CLR(cc->mask, type);
            }
            break;
+       case CC_MAX_STALE:
+           if (!p || !httpHeaderParseInt(p, &cc->max_stale)) {
+               debug(65, 2) ("cc: max-stale directive is valid without value\n");
+               cc->max_stale = -1;
+           }
+           break;
        default:
            /* note that we ignore most of '=' specs */
            break;
@@ -164,6 +171,7 @@ httpHdrCcDup(const HttpHdrCc * cc)
     dup->mask = cc->mask;
     dup->max_age = cc->max_age;
     dup->s_maxage = cc->s_maxage;
+    dup->max_stale = cc->max_stale;
     return dup;
 }
 
@@ -186,6 +194,9 @@ httpHdrCcPackInto(const HttpHdrCc * cc, Packer * p)
            if (flag == CC_S_MAXAGE)
                packerPrintf(p, "=%d", (int) cc->s_maxage);
 
+           if (flag == CC_MAX_STALE)
+               packerPrintf(p, "=%d", (int) cc->max_stale);
+
            pcount++;
        }
     }
@@ -199,6 +210,8 @@ httpHdrCcJoinWith(HttpHdrCc * cc, const HttpHdrCc * new_cc)
        cc->max_age = new_cc->max_age;
     if (cc->s_maxage < 0)
        cc->s_maxage = new_cc->s_maxage;
+    if (cc->max_stale < 0)
+       cc->max_stale = new_cc->max_stale;
     cc->mask |= new_cc->mask;
 }
 
index fa75ef507162e9a2e902cf414e4d5bf3138cf226..de796a203fc6d3a75c55beadb9bfc599496613d7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.174 2000/10/17 08:06:03 adrian Exp $
+ * $Id: enums.h,v 1.175 2000/11/09 03:09:47 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -231,7 +231,6 @@ typedef enum {
     HDR_ENUM_END
 } http_hdr_type;
 
-/* server cache-control */
 typedef enum {
     CC_PUBLIC,
     CC_PRIVATE,
@@ -242,6 +241,7 @@ typedef enum {
     CC_PROXY_REVALIDATE,
     CC_MAX_AGE,
     CC_S_MAXAGE,
+    CC_MAX_STALE,
     CC_ONLY_IF_CACHED,
     CC_OTHER,
     CC_ENUM_END
index 6738ba2e9257fe869812c04a420939de8fbce079..4a31e709c04f82bbeca79d4a1d876405fa532683 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.358 2000/11/01 04:03:15 wessels Exp $
+ * $Id: structs.h,v 1.359 2000/11/09 03:09:47 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -675,6 +675,7 @@ struct _HttpHdrCc {
     int mask;
     int max_age;
     int s_maxage;
+    int max_stale;
 };
 
 /* http byte-range-spec */