/*
- * $Id: cache_cf.cc,v 1.299 1998/08/20 02:49:10 wessels Exp $
+ * $Id: cache_cf.cc,v 1.300 1998/08/20 22:45:44 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
{
while (head != NULL) {
- storeAppendPrintf(entry, "%s%s %s %d %d%% %d%s%s\n",
+ storeAppendPrintf(entry, "%s%s %s %d %d%% %d%s%s%s%s\n",
name,
head->flags.icase ? " -i" : null_string,
head->pattern,
(int) head->min / 60,
(int) (100.0 * head->pct + 0.5),
(int) head->max / 60,
- head->flags.override_expire ? " override_expire" : null_string,
- head->flags.override_lastmod ? " override_lastmod" : null_string);
+ head->flags.override_expire ? " override-expire" : null_string,
+ head->flags.override_lastmod ? " override-lastmod" : null_string,
+ head->flags.reload_into_ims ? " reload-into-ims" : null_string,
+ head->flags.ignore_reload ? " ignore-reload" : null_string);
head = head->next;
}
}
time_t max = 0;
int override_expire = 0;
int override_lastmod = 0;
+ int reload_into_ims = 0;
+ int ignore_reload = 0;
int i;
refresh_t *t;
regex_t comp;
override_expire = 1;
else if (!strcmp(token, "override-expire"))
override_lastmod = 1;
- else
- debug(22, 0) ("redreshAddToLost: Unknown option '%s': %s\n",
+ else if (!strcmp(token, "reload-into-ims")) {
+ reload_into_ims = 1;
+ refresh_nocache_hack = 1;
+ /* tell client_side.c that this is used */
+ } else if (!strcmp(token, "ignore-reload")) {
+ ignore_reload = 1;
+ refresh_nocache_hack = 1;
+ /* tell client_side.c that this is used */
+ } else
+ debug(22, 0) ("redreshAddToList: Unknown option '%s': %s\n",
pattern, token);
}
if ((errcode = regcomp(&comp, pattern, flags)) != 0) {
t->flags.override_expire = 1;
if (override_lastmod)
t->flags.override_lastmod = 1;
+ if (reload_into_ims)
+ t->flags.reload_into_ims = 1;
+ if (ignore_reload)
+ t->flags.ignore_reload = 1;
t->next = NULL;
while (*head)
head = &(*head)->next;
#
-# $Id: cf.data.pre,v 1.98 1998/08/17 23:27:59 wessels Exp $
+# $Id: cf.data.pre,v 1.99 1998/08/20 22:45:45 wessels Exp $
#
#
# SQUID Internet Object Cache http://squid.nlanr.net/Squid/
options: override-expire
override-lastmod
+ reload-into-ims
+ ignore-reload
override-expire enforces min age even if the server
- sent a Expires: header. Warning: This breaks HTTP
- freshness control, and may have servere inpact on
- the usability of sites that makes correct use of
- Expires: headers on dynamic data.
+ sent a Expires: header. Doing this VIOLATES the HTTP
+ standard. Enabling this feature could make you liable
+ for problems which it causes.
override-lastmod enforces min age even on objects
that was modified recently.
+
+ reload-into-ims changes client no-cache or ``reload''
+ to If-Modified-Since requests. Doing this VIOLATES the
+ HTTP standard. Enabling this feature could make you
+ liable for problems which it causes.
+
+ ignore-reload ignores a client no-cache or ``reload''
+ header. Doing this VIOLATES the HTTP standard. Enabling
+ this feature could make you liable for problems which
+ it causes.
Please see the file doc/Release-Notes-1.1.txt for a full
description of Squid's refresh algorithm. Basically a
Doing this VIOLATES the HTTP standard. Enabling this
feature could make you liable for problems which it
causes.
+
+ see also refresh_pattern for a more selective approach.
+
reload_into_ims off
DOC_END
/*
- * $Id: client_side.cc,v 1.383 1998/08/19 23:07:23 wessels Exp $
+ * $Id: client_side.cc,v 1.384 1998/08/20 22:45:46 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
if (httpHeaderHas(req_hdr, HDR_PRAGMA)) {
String s = httpHeaderGetList(req_hdr, HDR_PRAGMA);
if (strListIsMember(&s, "no-cache", ',')) {
- if (!Config.onoff.reload_into_ims)
- EBIT_SET(request->flags, REQ_NOCACHE);
+ if (Config.onoff.reload_into_ims)
+ EBIT_SET(request->flags, REQ_NOCACHE_HACK);
+ else if (refresh_nocache_hack)
+ EBIT_SET(request->flags, REQ_NOCACHE_HACK);
else
- EBIT_SET(request->flags, REQ_NOCACHE_IMS);
+ EBIT_SET(request->flags, REQ_NOCACHE);
}
stringClean(&s);
}
*/
http->log_type = LOG_TCP_MISS;
clientProcessMiss(http);
+ } else if (EBIT_TEST(r->flags, REQ_NOCACHE)) {
+ /*
+ * This did not match a refresh pattern that overrides no-cache
+ * we should honour the client no-cache header.
+ */
+ http->log_type = LOG_TCP_CLIENT_REFRESH_MISS;
+ clientProcessMiss(http);
} else if (r->protocol == PROTO_HTTP) {
+ /*
+ * Object needs to be revalidated
+ * XXX This could apply to FTP as well, if Last-Modified is known.
+ */
http->log_type = LOG_TCP_REFRESH_MISS;
clientProcessExpired(http);
} else {
+ /*
+ * We don't know how to re-validate other protocols. Handle
+ * them as if the object has expired.
+ */
http->log_type = LOG_TCP_MISS;
clientProcessMiss(http);
}
/* this object isn't in the cache */
return LOG_TCP_MISS;
} else if (!storeEntryValidToSend(e)) {
- storeRelease(e);
http->entry = NULL;
return LOG_TCP_MISS;
} else if (EBIT_TEST(e->flag, ENTRY_SPECIAL)) {
/* Special entries are always hits, no matter what the client says */
http->entry = e;
return LOG_TCP_HIT;
- } else if (EBIT_TEST(r->flags, REQ_NOCACHE)) {
- /* NOCACHE should always eject a negative cached object */
- if (EBIT_TEST(e->flag, ENTRY_NEGCACHED))
- storeRelease(e);
- /* NOCACHE+IMS should not eject a valid object */
- else if (EBIT_TEST(r->flags, REQ_IMS))
- (void) 0;
- /* Request-Range should not eject a valid object */
- else if (EBIT_TEST(r->flags, REQ_RANGE))
- (void) 0;
- else
- storeRelease(e);
+ } else if (EBIT_TEST(r->flags, REQ_NOCACHE_HACK)) {
+ http->entry = NULL;
ipcacheReleaseInvalid(r->host);
+ return LOG_TCP_CLIENT_REFRESH_MISS;
+ } else if (EBIT_TEST(r->flags, REQ_NOCACHE)) {
http->entry = NULL;
+ ipcacheReleaseInvalid(r->host);
return LOG_TCP_CLIENT_REFRESH_MISS;
} else {
http->entry = e;
/*
- * $Id: enums.h,v 1.120 1998/08/20 22:29:58 wessels Exp $
+ * $Id: enums.h,v 1.121 1998/08/20 22:45:47 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
REQ_REFRESH,
REQ_USED_PROXY_AUTH,
REQ_REDIRECTED,
- REQ_NOCACHE_IMS /* for changing no-cache requests into IMS */
+ REQ_NOCACHE_HACK /* for changing/ignoring no-cache requests */
};
enum {
/*
- * $Id: globals.h,v 1.63 1998/07/31 00:15:44 wessels Exp $
+ * $Id: globals.h,v 1.64 1998/08/20 22:45:48 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
#if DELAY_POOLS
extern time_t delay_pools_last_update; /* 0 */
#endif
+extern int refresh_nocache_hack; /* 0 */
+
/*
- * $Id: refresh.cc,v 1.31 1998/08/17 21:27:32 wessels Exp $
+ * $Id: refresh.cc,v 1.32 1998/08/20 22:45:49 wessels Exp $
*
* DEBUG: section 22 Refresh Calculation
* AUTHOR: Harvest Derived
time_t max = REFRESH_DEFAULT_MAX;
int override_expire = 0;
int override_lastmod = 0;
+ int reload_into_ims = 0;
+ int ignore_reload = 0;
const char *pattern = ".";
time_t age;
double factor;
refreshCounts.revalidate_stale++;
return 1;
}
- if (EBIT_TEST(request->flags, REQ_NOCACHE_IMS)) {
- debug(22, 3) ("refreshCheck: YES: Reload into IMS\n");
- refreshCounts.revalidate_stale++;
- return 1;
- }
if ((R = refreshLimits(uri))) {
min = R->min;
pct = R->pct;
pattern = R->pattern;
override_expire = R->flags.override_expire;
override_lastmod = R->flags.override_lastmod;
+ reload_into_ims = R->flags.reload_into_ims;
+ ignore_reload = R->flags.ignore_reload;
}
+ if (!reload_into_ims)
+ reload_into_ims = Config.onoff.reload_into_ims;
debug(22, 3) ("refreshCheck: Matched '%s %d %d%% %d'\n",
pattern, (int) min, (int) (100.0 * pct), (int) max);
age = check_time - entry->timestamp;
debug(22, 3) ("refreshCheck: age = %d\n", (int) age);
debug(22, 3) ("\tcheck_time:\t%s\n", mkrfc1123(check_time));
debug(22, 3) ("\tentry->timestamp:\t%s\n", mkrfc1123(entry->timestamp));
+ if (EBIT_TEST(request->flags, REQ_NOCACHE_HACK)) {
+ if (ignore_reload) {
+ /* The clients no-cache header is ignored */
+ debug(22, 3) ("refreshCheck: MAYBE: ignore-reload\n");
+ } else if (reload_into_ims) {
+ /* The clients no-cache header is changed into a IMS query */
+ debug(22, 3) ("refreshCheck: YES: reload-into-ims\n");
+ return 1;
+ } else {
+ /* The clients no-cache header is not overridden on this request */
+ debug(22, 3) ("refreshCheck: YES: client reload\n");
+ EBIT_SET(request->flags, REQ_NOCACHE);
+ return 1;
+ }
+ }
if (request->max_age > -1) {
if (age > request->max_age) {
debug(22, 3) ("refreshCheck: YES: age > client-max-age\n");
/*
- * $Id: structs.h,v 1.206 1998/08/19 23:10:30 wessels Exp $
+ * $Id: structs.h,v 1.207 1998/08/20 22:45:50 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
};
#if USE_ARP_ACL
+
struct _acl_arp_data {
char eth[6];
};
+
#endif
struct _String {
unsigned int icase:1;
unsigned int override_expire:1;
unsigned int override_lastmod:1;
+ unsigned int reload_into_ims:1;
+ unsigned int ignore_reload:1;
} flags;
};