From: hno <> Date: Mon, 6 Jun 2005 05:29:02 +0000 (+0000) Subject: Rearrange the detection of internal URLs slightly to make it easier to X-Git-Tag: SQUID_3_0_PRE4~729 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f024c97018f3f26facf049253734e2910cdeda5d;p=thirdparty%2Fsquid.git Rearrange the detection of internal URLs slightly to make it easier to fix the Date header on internal objects (Bug #1275). --- diff --git a/src/cf.data.pre b/src/cf.data.pre index 42d333beda..c61291b431 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -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 diff --git a/src/client_side.cc b/src/client_side.cc index 405032c5e4..cd1d49d0d3 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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; diff --git a/src/structs.h b/src/structs.h index c392d3a86d..f73d5f80ff 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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;