From: wessels <> Date: Thu, 9 Nov 2000 10:09:47 +0000 (+0000) Subject: DW: X-Git-Tag: SQUID_3_0_PRE1~1781 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=49ff0930328b7ab976e8e2fa86cf1dc1a956891d;p=thirdparty%2Fsquid.git DW: - Adding max-stale cache-control directive. --- diff --git a/src/HttpHdrCc.cc b/src/HttpHdrCc.cc index 80e7d99383..ef6836cf4b 100644 --- a/src/HttpHdrCc.cc +++ b/src/HttpHdrCc.cc @@ -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; } diff --git a/src/enums.h b/src/enums.h index fa75ef5071..de796a203f 100644 --- a/src/enums.h +++ b/src/enums.h @@ -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 diff --git a/src/structs.h b/src/structs.h index 6738ba2e92..4a31e709c0 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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 */