]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Rearrange the detection of internal URLs slightly to make it easier to
authorhno <>
Mon, 6 Jun 2005 05:29:02 +0000 (05:29 +0000)
committerhno <>
Mon, 6 Jun 2005 05:29:02 +0000 (05:29 +0000)
fix the Date header on internal objects (Bug #1275).

src/cf.data.pre
src/client_side.cc
src/structs.h

index 42d333bedac9f6fc532c9704d7c68ab115e46ac7..c61291b431c452424aec486ab83bdc3ef9844721 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.390 2005/05/09 01:41:25 hno Exp $
+# $Id: cf.data.pre,v 1.391 2005/06/05 23:29:02 hno Exp $
 #
 #
 # SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -3778,6 +3778,20 @@ DOC_START
        @DEFAULT_ICON_DIR@
 DOC_END
 
+NAME: global_internal_static
+TYPE: onoff
+LOC: Config.onoff.global_internal_static
+DEFAULT: on
+DOC_START
+       This directive controls is Squid should intercept all requests for
+       /squid-internal-static/ no matter which host the URL is requesting
+       (default on setting), or if nothing special should be done for
+       such URLs (off setting). The purpose of this directive is to make
+       icons etc work better in complex cache hierarchies where it may
+       not always be possible for all corners in the cache mesh to reach
+       the server generating a directory listing.
+DOC_END
+
 NAME: short_icon_urls
 TYPE: onoff
 LOC: Config.icons.use_short_names
index 405032c5e405be619cdc5ebbc851383243b16a5d..cd1d49d0d391a41e6463be7e69f560b7e07c5119 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.684 2005/03/19 19:43:39 serassio Exp $
+ * $Id: client_side.cc,v 1.685 2005/06/05 23:29:02 hno Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -1765,7 +1765,6 @@ prepareAcceleratedURL(ConnStateData::Pointer & conn, clientHttpRequest *http, ch
     if (internalCheck(url)) {
         /* prepend our name & port */
         http->uri = xstrdup(internalLocalUri(NULL, url));
-        http->flags.internal = 1;
     } else if (vhost && (host = mime_get_header(req_hdr, "Host")) != NULL) {
         int url_sz = strlen(url) + 32 + Config.appendDomainLen +
                      strlen(host);
@@ -1813,11 +1812,7 @@ prepareTransparentURL(ConnStateData::Pointer & conn, clientHttpRequest *http, ch
 
     /* BUG: Squid cannot deal with '*' URLs (RFC2616 5.1.2) */
 
-    if (internalCheck(url)) {
-        /* prepend our name & port */
-        http->uri = xstrdup(internalLocalUri(NULL, url));
-        http->flags.internal = 1;
-    } else if ((host = mime_get_header(req_hdr, "Host")) != NULL) {
+    if ((host = mime_get_header(req_hdr, "Host")) != NULL) {
         int url_sz = strlen(url) + 32 + Config.appendDomainLen +
                      strlen(host);
         http->uri = (char *)xcalloc(url_sz, 1);
@@ -1999,7 +1994,6 @@ parseHttpRequest(ConnStateData::Pointer & conn, method_t * method_p,
     } else if (internalCheck(url)) {
         /* prepend our name & port */
         http->uri = xstrdup(internalLocalUri(NULL, url));
-        http->flags.internal = 1;
         http->flags.accel = 1;
     }
 
@@ -2231,23 +2225,21 @@ clientProcessRequest(ConnStateData::Pointer &conn, ClientSocketContext *context,
 
     request->flags.transparent = http->flags.transparent;
 
-    if (!http->flags.internal) {
-        if (internalCheck(request->urlpath.buf())) {
-            if (internalHostnameIs(request->host) &&
-                    request->port == getMyPort()) {
-                http->flags.internal = 1;
-            } else if (internalStaticCheck(request->urlpath.buf())) {
-                xstrncpy(request->host, internalHostname(),
-                         SQUIDHOSTNAMELEN);
-                request->port = getMyPort();
-                http->flags.internal = 1;
-            }
+    if (internalCheck(request->urlpath.buf())) {
+        if (internalHostnameIs(request->host) &&
+                request->port == getMyPort()) {
+            http->flags.internal = 1;
+        } else if (Config.onoff.global_internal_static && internalStaticCheck(request->urlpath.buf())) {
+            xstrncpy(request->host, internalHostname(),
+                     SQUIDHOSTNAMELEN);
+            request->port = getMyPort();
+            http->flags.internal = 1;
         }
+    }
 
-        if (http->flags.internal) {
-            request->protocol = PROTO_HTTP;
-            request->login[0] = '\0';
-        }
+    if (http->flags.internal) {
+        request->protocol = PROTO_HTTP;
+        request->login[0] = '\0';
     }
 
     request->flags.internal = http->flags.internal;
index c392d3a86dbe4ccf677c12b8c73604fdf3700324..f73d5f80fffe85aed45a404f7a120602c00a89a9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.519 2005/05/05 15:44:45 serassio Exp $
+ * $Id: structs.h,v 1.520 2005/06/05 23:29:02 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -580,6 +580,7 @@ struct _SquidConfig
         int via;
         int emailErrData;
         int httpd_suppress_version_string;
+        int global_internal_static;
     }
 
     onoff;