/*
- * $Id: cache_cf.cc,v 1.300 1998/08/20 22:45:44 wessels Exp $
+ * $Id: cache_cf.cc,v 1.301 1998/08/21 04:03:44 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
configDoConfigure(void)
{
LOCAL_ARRAY(char, buf, BUFSIZ);
- const refresh_t *R;
memset(&Config2, '\0', sizeof(SquidConfig2));
/* init memory as early as possible */
memConfigure();
requirePathnameExists("authenticate_program", Config.Program.authenticate->key);
requirePathnameExists("Icon Directory", Config.icons.directory);
requirePathnameExists("Error Directory", Config.errorDirectory);
+#if HTTP_VIOLATIONS
+ {
+ const refresh_t *R;
for (R = Config.Refresh; R; R = R->next) {
if (!R->flags.override_expire)
continue;
debug(22, 1) ("WARNING: use of 'override-lastmod' in 'refresh_pattern' violates HTTP\n");
break;
}
+ }
+#endif
}
/* Parse a time specification from the config file. Store the
dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
{
while (head != NULL) {
- storeAppendPrintf(entry, "%s%s %s %d %d%% %d%s%s%s%s\n",
+ storeAppendPrintf(entry, "%s%s %s %d %d%% %d\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.reload_into_ims ? " reload-into-ims" : null_string,
- head->flags.ignore_reload ? " ignore-reload" : null_string);
+ (int) head->max / 60);
+#if HTTP_VIOLATIONS
+ if (head->flags.override_expire)
+ storeAppendPrintf(entry, " override-expire");
+ if (head->flags.override_lastmod)
+ storeAppendPrintf(entry, " override-lastmod");
+ if (head->flags.reload_into_ims)
+ storeAppendPrintf(entry, " reload-into-ims");
+ if (head->flags.ignore_reload)
+ storeAppendPrintf(entry, " ignore-reload");
+#endif
+ storeAppendPrintf(entry, "\n");
head = head->next;
}
}
time_t min = 0;
double pct = 0.0;
time_t max = 0;
+#if HTTP_VIOLATIONS
int override_expire = 0;
int override_lastmod = 0;
int reload_into_ims = 0;
int ignore_reload = 0;
+#endif
int i;
refresh_t *t;
regex_t comp;
max = (time_t) (i * 60); /* convert minutes to seconds */
/* Options */
while ((token = strtok(NULL, w_space)) != NULL) {
+#if HTTP_VIOLATIONS
if (!strcmp(token, "override-expire"))
override_expire = 1;
else if (!strcmp(token, "override-expire"))
refresh_nocache_hack = 1;
/* tell client_side.c that this is used */
} else
+#endif
debug(22, 0) ("redreshAddToList: Unknown option '%s': %s\n",
pattern, token);
}
t->max = max;
if (flags & REG_ICASE)
t->flags.icase = 1;
+#if HTTP_VIOLATIONS
if (override_expire)
t->flags.override_expire = 1;
if (override_lastmod)
t->flags.reload_into_ims = 1;
if (ignore_reload)
t->flags.ignore_reload = 1;
+#endif
t->next = NULL;
while (*head)
head = &(*head)->next;
#
-# $Id: cf.data.pre,v 1.99 1998/08/20 22:45:45 wessels Exp $
+# $Id: cf.data.pre,v 1.100 1998/08/21 04:03:45 wessels Exp $
#
#
# SQUID Internet Object Cache http://squid.nlanr.net/Squid/
DOC_END
NAME: reload_into_ims
+IFDEF: HTTP_VIOLATIONS
COMMENT: on|off
TYPE: onoff
DEFAULT: off
/*
- * $Id: client_side.cc,v 1.385 1998/08/21 03:15:15 wessels Exp $
+ * $Id: client_side.cc,v 1.386 1998/08/21 04:03: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 HTTP_VIOLATIONS
if (Config.onoff.reload_into_ims)
request->flags.nocache_hack = 1;
else if (refresh_nocache_hack)
request->flags.nocache_hack = 1;
else
+#endif
request->flags.nocache = 1;
}
stringClean(&s);
/* Special entries are always hits, no matter what the client says */
http->entry = e;
return LOG_TCP_HIT;
+#if HTTP_VIOLATIONS
} else if (r->flags.nocache_hack) {
http->entry = NULL;
ipcacheReleaseInvalid(r->host);
return LOG_TCP_CLIENT_REFRESH_MISS;
+#endif
} else if (r->flags.nocache) {
http->entry = NULL;
ipcacheReleaseInvalid(r->host);
/*
- * $Id: globals.h,v 1.65 1998/08/21 03:15:17 wessels Exp $
+ * $Id: globals.h,v 1.66 1998/08/21 04:03:47 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
#if DELAY_POOLS
extern time_t delay_pools_last_update; /* 0 */
#endif
+#if HTTP_VIOLATIONS
extern int refresh_nocache_hack; /* 0 */
+#endif
extern request_flags null_request_flags;
/*
- * $Id: refresh.cc,v 1.33 1998/08/21 03:15:23 wessels Exp $
+ * $Id: refresh.cc,v 1.34 1998/08/21 04:03:48 wessels Exp $
*
* DEBUG: section 22 Refresh Calculation
* AUTHOR: Harvest Derived
time_t min = REFRESH_DEFAULT_MIN;
double pct = REFRESH_DEFAULT_PCT;
time_t max = REFRESH_DEFAULT_MAX;
+#if HTTP_VIOLATIONS
int override_expire = 0;
int override_lastmod = 0;
int reload_into_ims = 0;
int ignore_reload = 0;
+#endif
const char *pattern = ".";
time_t age;
double factor;
pct = R->pct;
max = R->max;
pattern = R->pattern;
+#if HTTP_VIOLATIONS
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;
+#endif
}
+#if HTTP_VIOLATIONS
if (!reload_into_ims)
reload_into_ims = Config.onoff.reload_into_ims;
+#endif
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 HTTP_VIOLATIONS
if (request->flags.nocache_hack) {
if (ignore_reload) {
/* The clients no-cache header is ignored */
return 1;
}
}
+#endif
if (request->max_age > -1) {
if (age > request->max_age) {
debug(22, 3) ("refreshCheck: YES: age > client-max-age\n");
return 1;
}
}
+#if HTTP_VIOLATIONS
if (override_expire && age <= min) {
debug(22, 3) ("refreshCheck: NO: age < min && override_expire\n");
return 0;
}
+#endif
if (entry->expires > -1) {
if (entry->expires <= check_time) {
debug(22, 3) ("refreshCheck: YES: expires <= curtime\n");
refreshCounts.conf_max_age_stale++;
return 1;
}
+#if HTTP_VIOLATIONS
if (override_lastmod && age <= min) {
debug(22, 3) ("refreshCheck: NO: age < min && override_lastmod\n");
return 0;
}
+#endif
if (entry->lastmod > -1 && entry->timestamp > entry->lastmod) {
factor = (double) age / (double) (entry->timestamp - entry->lastmod);
debug(22, 3) ("refreshCheck: factor = %f\n", factor);
/*
- * $Id: structs.h,v 1.208 1998/08/21 03:15:26 wessels Exp $
+ * $Id: structs.h,v 1.209 1998/08/21 04:03:49 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
int mem_pools;
int test_reachability;
int half_closed_clients;
+#if HTTP_VIOLATIONS
int reload_into_ims;
+#endif
} onoff;
acl *aclList;
struct {
int refresh:1;
int used_proxy_auth:1;
int redirected:1;
+#if HTTP_VIOLATIONS
int nocache_hack:1; /* for changing/ignoring no-cache requests */
+#endif
};
struct _request_t {
refresh_t *next;
struct {
unsigned int icase:1;
+#if HTTP_VIOLATIONS
unsigned int override_expire:1;
unsigned int override_lastmod:1;
unsigned int reload_into_ims:1;
unsigned int ignore_reload:1;
+#endif
} flags;
};