From: wessels <> Date: Wed, 20 Jan 1999 03:26:32 +0000 (+0000) Subject: We had false loop detections because "ee.lbl.gov" matched "ren.ee.lbl.gov". X-Git-Tag: SQUID_3_0_PRE1~2379 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38a6c74e0f420e5d98b6b9953fa0b9473934f54c;p=thirdparty%2Fsquid.git We had false loop detections because "ee.lbl.gov" matched "ren.ee.lbl.gov". Added variable (ThisCache2) that has a space prepended to the hostname so we now search for " ee.lbl.gov". --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 82d4a8c03d..030c50dfa9 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.317 1998/12/16 00:07:17 wessels Exp $ + * $Id: cache_cf.cc,v 1.318 1999/01/19 20:26:33 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -262,6 +262,14 @@ configDoConfigure(void) uniqueHostname(), (int) Config.Port.http->i, full_appname_string); + /* + * the extra space is for loop detection in client_side.c -- we search + * for substrings in the Via header. + */ + snprintf(ThisCache2, sizeof(ThisCache), " %s:%d (%s)", + uniqueHostname(), + (int) Config.Port.http->i, + full_appname_string); if (!Config.udpMaxHitObjsz || Config.udpMaxHitObjsz > SQUID_UDP_SO_SNDBUF) Config.udpMaxHitObjsz = SQUID_UDP_SO_SNDBUF; if (Config.appendDomain) diff --git a/src/client_side.cc b/src/client_side.cc index cbf12cccc5..4e657dc474 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.432 1999/01/19 02:24:23 wessels Exp $ + * $Id: client_side.cc,v 1.433 1999/01/19 20:26:35 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -739,8 +739,12 @@ clientInterpretRequestHeaders(clientHttpRequest * http) request->flags.auth = 1; if (httpHeaderHas(req_hdr, HDR_VIA)) { String s = httpHeaderGetList(req_hdr, HDR_VIA); - /* ThisCache cannot be a member of Via header, "1.0 ThisCache" can */ - if (strListIsSubstr(&s, ThisCache, ',')) { + /* + * ThisCache cannot be a member of Via header, "1.0 ThisCache" can. + * Note ThisCache2 has a space prepended to the hostname so we don't + * accidentally match super-domains. + */ + if (strListIsSubstr(&s, ThisCache2, ',')) { debugObj(33, 1, "WARNING: Forwarding loop detected for:\n", request, (ObjPackMethod) & httpRequestPack); request->flags.loopdetect = 1; diff --git a/src/globals.h b/src/globals.h index 80be0c8ff0..24faabdc68 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.74 1998/12/09 23:01:00 wessels Exp $ + * $Id: globals.h,v 1.75 1999/01/19 20:26:32 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -42,6 +42,7 @@ extern const char *log_tags[]; extern char tmp_error_buf[ERROR_BUF_SZ]; extern char *volatile debug_options; /* NULL */ extern char ThisCache[SQUIDHOSTNAMELEN << 1]; +extern char ThisCache2[SQUIDHOSTNAMELEN << 1]; extern char config_input_line[BUFSIZ]; extern const char *AclMatchedName; /* NULL */ extern const char *DefaultConfigFile; /* DEFAULT_CONFIG_FILE */