/*
- * $Id: cache_cf.cc,v 1.455 2004/10/15 21:10:44 hno Exp $
+ * $Id: cache_cf.cc,v 1.456 2004/11/06 22:20:47 hno Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
break;
}
+ for (R = Config.Refresh; R; R = R->next)
+ {
+ if (!R->flags.reload_into_ims)
+ continue;
+
+ debug(22, 1) ("WARNING: use of 'reload-into-ims' in 'refresh_pattern' violates HTTP\n");
+
+ break;
+ }
+
+ for (R = Config.Refresh; R; R = R->next)
+ {
+ if (!R->flags.ignore_reload)
+ continue;
+
+ debug(22, 1) ("WARNING: use of 'ignore-reload' in 'refresh_pattern' violates HTTP\n");
+
+ break;
+ }
+
+ for (R = Config.Refresh; R; R = R->next)
+ {
+ if (!R->flags.ignore_no_cache)
+ continue;
+
+ debug(22, 1) ("WARNING: use of 'ignore-no-cache' in 'refresh_pattern' violates HTTP\n");
+
+ break;
+ }
+
+ for (R = Config.Refresh; R; R = R->next)
+ {
+ if (!R->flags.ignore_no_store)
+ continue;
+
+ debug(22, 1) ("WARNING: use of 'ignore-no-store' in 'refresh_pattern' violates HTTP\n");
+
+ break;
+ }
+
+ for (R = Config.Refresh; R; R = R->next)
+ {
+ if (!R->flags.ignore_private)
+ continue;
+
+ debug(22, 1) ("WARNING: use of 'ignore-private' in 'refresh_pattern' violates HTTP\n");
+
+ break;
+ }
+
+ for (R = Config.Refresh; R; R = R->next)
+ {
+ if (!R->flags.ignore_auth)
+ continue;
+
+ debug(22, 1) ("WARNING: use of 'ignore-auth' in 'refresh_pattern' violates HTTP\n");
+
+ break;
+ }
+
}
#endif
#if !HTTP_VIOLATIONS
if (head->flags.ignore_reload)
storeAppendPrintf(entry, " ignore-reload");
+ if (head->flags.ignore_no_cache)
+ storeAppendPrintf(entry, " ignore-no-cache");
+
+ if (head->flags.ignore_no_store)
+ storeAppendPrintf(entry, " ignore-no-store");
+
+ if (head->flags.ignore_private)
+ storeAppendPrintf(entry, " ignore-private");
+
+ if (head->flags.ignore_auth)
+ storeAppendPrintf(entry, " ignore-auth");
+
#endif
storeAppendPrintf(entry, "\n");
int override_lastmod = 0;
int reload_into_ims = 0;
int ignore_reload = 0;
+ int ignore_no_cache = 0;
+ int ignore_no_store = 0;
+ int ignore_private = 0;
+ int ignore_auth = 0;
#endif
int i;
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, "ignore-no-store"))
+ ignore_no_store = 1;
+ else if (!strcmp(token, "ignore-private"))
+ ignore_private = 1;
+ else if (!strcmp(token, "ignore-auth"))
+ ignore_auth = 1;
else if (!strcmp(token, "reload-into-ims")) {
reload_into_ims = 1;
refresh_nocache_hack = 1;
if (ignore_reload)
t->flags.ignore_reload = 1;
+ if (ignore_no_cache)
+ t->flags.ignore_no_cache = 1;
+
+ if (ignore_no_store)
+ t->flags.ignore_no_store = 1;
+
+ if (ignore_private)
+ t->flags.ignore_private = 1;
+
+ if (ignore_auth)
+ t->flags.ignore_auth = 1;
+
#endif
t->next = NULL;
#
-# $Id: cf.data.pre,v 1.361 2004/10/20 22:41:04 hno Exp $
+# $Id: cf.data.pre,v 1.362 2004/11/06 22:20:47 hno Exp $
#
#
# SQUID Web Proxy Cache http://www.squid-cache.org/
override-lastmod
reload-into-ims
ignore-reload
+ ignore-no-cache
+ ignore-no-store
+ ignore-private
+ ignore-auth
override-expire enforces min age even if the server
sent a Expires: header. Doing this VIOLATES the HTTP
this feature could make you liable for problems which
it causes.
+ ignore-no-cache ignores any ``Pragma: no-cache'' and
+ ``Cache-control: no-cache'' headers received from a server.
+ The HTTP RFC never allows the use of this (Pragma) header
+ from a server, only a client, though plenty of servers
+ send it anyway.
+
+ ignore-no-store ignores any ``Cache-control: no-store''
+ headers received from a server. Doing this VIOLATES
+ the HTTP standard. Enabling this feature could make you
+ liable for problems which it causes.
+
+ ignore-private ignores any ``Cache-control: private''
+ headers received from a server. Doing this VIOLATES
+ the HTTP standard. Enabling this feature could make you
+ liable for problems which it causes.
+
+ ignore-auth caches responses to requests with authorization,
+ irrespective of ``Cache-control'' headers received from
+ a server. Doing this VIOLATES the HTTP standard. Enabling
+ this feature could make you liable for problems which
+ it causes.
+
Basically a cached object is:
FRESH if expires < now, else STALE
/*
- * $Id: http.cc,v 1.433 2004/10/10 03:06:17 hno Exp $
+ * $Id: http.cc,v 1.434 2004/11/06 22:20:47 hno Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
#endif
}
-int
-cacheControlAllowsCaching(HttpHdrCc *cc)
-{
- if (cc) {
- const int cc_mask = cc->mask;
-
- 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_STORE))
- return 0;
- }
-
- return 1;
-}
-
int
HttpStateData::cacheableReply()
{
HttpHeader const *hdr = &rep->header;
const int cc_mask = (rep->cache_control) ? rep->cache_control->mask : 0;
const char *v;
+#if HTTP_VIOLATIONS
- if (surrogateNoStore)
- return 0;
+ const refresh_t *R = NULL;
+#endif
- if (!cacheControlAllowsCaching(rep->cache_control))
+ if (surrogateNoStore)
return 0;
if (!ignoreCacheControl) {
- if (EBIT_TEST(cc_mask, CC_PRIVATE))
- return 0;
+ if (EBIT_TEST(cc_mask, CC_PRIVATE)) {
+#if HTTP_VIOLATIONS
- if (EBIT_TEST(cc_mask, CC_NO_CACHE))
- return 0;
+ if (!R)
+ R = refreshLimits(entry->mem_obj->url);
- if (EBIT_TEST(cc_mask, CC_NO_STORE))
- return 0;
+ if (R && !R->flags.ignore_private)
+#endif
+
+ return 0;
+ }
+
+ if (EBIT_TEST(cc_mask, CC_NO_CACHE)) {
+#if HTTP_VIOLATIONS
+
+ if (!R)
+ R = refreshLimits(entry->mem_obj->url);
+
+ if (R && !R->flags.ignore_no_cache)
+#endif
+
+ return 0;
+ }
+
+ if (EBIT_TEST(cc_mask, CC_NO_STORE)) {
+#if HTTP_VIOLATIONS
+
+ if (!R)
+ R = refreshLimits(entry->mem_obj->url);
+
+ if (R && !R->flags.ignore_no_store)
+#endif
+
+ return 0;
+ }
}
if (request->flags.auth) {
* RFC 2068, sec 14.9.4
*/
- if (!EBIT_TEST(cc_mask, CC_PUBLIC))
- return 0;
+ if (!EBIT_TEST(cc_mask, CC_PUBLIC)) {
+#if HTTP_VIOLATIONS
+
+ if (!R)
+ R = refreshLimits(entry->mem_obj->url);
+
+ if (R && !R->flags.ignore_auth)
+#endif
+
+ return 0;
+ }
}
/* Pragma: no-cache in _replies_ is not documented in HTTP,
const int no_cache = strListIsMember(&s, "no-cache", ',');
s.clean();
- if (no_cache)
- return 0;
+ if (no_cache) {
+#if HTTP_VIOLATIONS
+
+ if (!R)
+ R = refreshLimits(entry->mem_obj->url);
+
+ if (R && !R->flags.ignore_no_cache)
+#endif
+
+ return 0;
+ }
}
/*
/*
- * $Id: protos.h,v 1.496 2004/10/18 12:20:10 hno Exp $
+ * $Id: protos.h,v 1.497 2004/11/06 22:20:47 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
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);
/*
- * $Id: refresh.cc,v 1.63 2003/08/10 11:00:44 robertc Exp $
+ * $Id: refresh.cc,v 1.64 2004/11/06 22:20:47 hno Exp $
*
* DEBUG: section 22 Refresh Calculation
* AUTHOR: Harvest Derived
#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;
/*
- * $Id: structs.h,v 1.493 2004/10/18 12:20:10 hno Exp $
+ * $Id: structs.h,v 1.494 2004/11/06 22:20:48 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
unsigned int ignore_reload:
1;
+
+unsigned int ignore_no_cache:
+ 1;
+
+unsigned int ignore_no_store:
+ 1;
+
+unsigned int ignore_private:
+ 1;
+
+unsigned int ignore_auth:
+ 1;
#endif
}