IE Refresh patch

From: Joe Cooper <joe@dont-contact.us>
Date: Fri, 08 Dec 2000 11:11:13 -0600

Hi folks,

Thanks to pointers from Henrik, Duane, and Robert, I've come up with an
IE refresh patch that Works For Me(TM). This patch takes into account
that IE 5.5 SP1 has been fixed to provide a proper
Cache-Control:no-cache directive in the request, and causes Squid to
always force a no-cache for older versions of IE on refresh. It adds an
ie_refresh squid.conf directive.

The patch applies against today's 2.4 snapshot (which is untested), and
I have a patch against 2.2STABLE5+hno (which is tested) on my homepage here:

http://www.swelltech.com/pengies/joe/patches/

The 2.2STABLE5 patch adds one extra line taken from 2.4, that adds
handling of Cache-Control in headers...It is required for 2.2 to work
with this patch, and I don't think it breaks anything (but I'm testing
now to be sure, and if someone knows this is wrong, please tell me).
                                   --
                      Joe Cooper <joe@swelltech.com>
                  Affordable Web Caching Proxy Appliances
                         http://www.swelltech.com

diff -uNr squid-2.4-200012080000/src/cf.data.pre squid-2.4-200012080000.ie/src/cf.data.pre
--- squid-2.4-200012080000/src/cf.data.pre Tue Oct 31 22:03:14 2000
+++ squid-2.4-200012080000.ie/src/cf.data.pre Fri Dec 8 10:17:51 2000
@@ -3282,5 +3282,27 @@
         This is currently work in progress.
 DOC_END
 
+NAME: ie_refresh
+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.
+ie_refresh off
+DOC_END
+
 EOF
 
diff -uNr squid-2.4-200012080000/src/client_side.c squid-2.4-200012080000.ie/src/client_side.c
--- squid-2.4-200012080000/src/client_side.c Tue Nov 14 20:34:02 2000
+++ squid-2.4-200012080000.ie/src/client_side.c Fri Dec 8 10:15:02 2000
@@ -823,9 +823,7 @@
     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)
@@ -840,6 +838,28 @@
     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 -uNr squid-2.4-200012080000/src/structs.h squid-2.4-200012080000.ie/src/structs.h
--- squid-2.4-200012080000/src/structs.h Mon Nov 13 06:25:13 2000
+++ squid-2.4-200012080000.ie/src/structs.h Fri Dec 8 10:19:28 2000
@@ -429,6 +429,7 @@
 #endif
         int log_ip_on_direct;
         int authenticateIpTTLStrict;
+ int ie_refresh;
     } onoff;
     acl *aclList;
     struct {
Received on Fri Dec 08 2000 - 10:03:55 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:03 MST