From: wessels <> Date: Sat, 9 Dec 2000 07:09:04 +0000 (+0000) Subject: Joe Cooper's hack for broken MSIE clients. They don't send no-cache X-Git-Tag: SQUID_3_0_PRE1~1740 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7613d09c4a728c07bbcc958fde01f02a24872f3a;p=thirdparty%2Fsquid.git Joe Cooper's hack for broken MSIE clients. They don't send no-cache in transparent mode. --- diff --git a/src/cf.data.pre b/src/cf.data.pre index 8614967603..ab160518d1 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.199 2000/11/01 04:03:14 wessels Exp $ +# $Id: cf.data.pre,v 1.200 2000/12/09 00:09:04 wessels Exp $ # # # SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -3282,5 +3282,29 @@ DOC_START This is currently work in progress. DOC_END +NAME: ie_refresh +COMMENT: on|off +TYPE: onoff +LOC: Config.onoff.ie_refresh +DEFAULT: off +DOC_START + Microsoft Internet Explorer up until version 5.5 Service + Pack 1 has an issue with transparent proxies, wherein it + is impossible to force a refresh. Turning this on provides + a partial fix to the problem, by causing all IMS-REFRESH + requests from older IE versions to check the origin server + for fresh content. This reduces hit ratio by some amount + (~10% in my experience), but allows users to actually get + fresh content when they want it. Note that because Squid + cannot tell if the user is using 5.5 or 5.5SP1, the behavior + of 5.5 is unchanged from old versions of Squid (i.e. a + forced refresh is impossible). Newer versions of IE will, + hopefully, continue to have the new behavior and will be + handled based on that assumption. This option defaults to + the old Squid behavior, which is better for hit ratios but + worse for clients using IE, if they need to be able to + force fresh content. +DOC_END + EOF diff --git a/src/client_side.cc b/src/client_side.cc index 199f34d669..3468c47ce0 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.515 2000/12/08 23:58:08 wessels Exp $ + * $Id: client_side.cc,v 1.516 2000/12/09 00:09:04 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -830,9 +830,7 @@ clientInterpretRequestHeaders(clientHttpRequest * http) request_t *request = http->request; const HttpHeader *req_hdr = &request->header; int no_cache = 0; -#if defined(USE_USERAGENT_LOG) || defined(USE_REFERER_LOG) const char *str; -#endif request->imslen = -1; request->ims = httpHeaderGetTime(req_hdr, HDR_IF_MODIFIED_SINCE); if (request->ims > 0) @@ -847,6 +845,28 @@ clientInterpretRequestHeaders(clientHttpRequest * http) if (request->cache_control) if (EBIT_TEST(request->cache_control->mask, CC_NO_CACHE)) no_cache++; + /* Work around for supporting the Reload button in IE browsers + * when Squid is used as an accelerator or transparent proxy, + * by turning accelerated IMS request to no-cache requests. + * Now knows about IE 5.5 fix (is actually only fixed in SP1, + * but we can't tell whether we are talking to SP1 or not so + * all 5.5 versions are treated 'normally'). + */ + if (Config.onoff.ie_refresh) { + if (http->flags.accel && request->flags.ims) { + if ( (str = httpHeaderGetStr(req_hdr, HDR_USER_AGENT)) ) { + if (strstr(str, "MSIE 5.01") != NULL) + no_cache++; + else if (strstr(str, "MSIE 5.0") != NULL) + no_cache++; + else if (strstr(str, "MSIE 4.") != NULL) + no_cache++; + else if (strstr(str, "MSIE 3.") != NULL) + no_cache++; + } + } + } + if (no_cache) { #if HTTP_VIOLATIONS if (Config.onoff.reload_into_ims) diff --git a/src/structs.h b/src/structs.h index f89cc6d799..6eeb3fbe9a 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.365 2000/12/08 23:58:09 wessels Exp $ + * $Id: structs.h,v 1.366 2000/12/09 00:09:04 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -430,6 +430,7 @@ struct _SquidConfig { #endif int log_ip_on_direct; int authenticateIpTTLStrict; + int ie_refresh; } onoff; acl *aclList; struct {