From: adrian <> Date: Wed, 15 Nov 2000 20:01:53 +0000 (+0000) Subject: Fixed the internal URL code to obey appendDomain for internal X-Git-Tag: SQUID_3_0_PRE1~1765 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1224d7408e1b4fc6715cc1cb577cb5e5bb8239e2;p=thirdparty%2Fsquid.git Fixed the internal URL code to obey appendDomain for internal objects if it needs appending. This fixes weirdnesses where a machine can think it is "foo.bar.com", and "foo" is requested. Submitted by: Brian Degenhardt --- diff --git a/ChangeLog b/ChangeLog index 51997bef18..ea1260d3ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ Changes to squid-2.5 - Fixed forwarding/peer loop detection code (Brian Degenhardt) - now a peer is ignored if it turns out to be us, rather than committing suicide + - Changed the internal URL code to obey appendDomain for internal + objects if it needs appending. This fixes weirdnesses where + a machine can think it is "foo.bar.com", and "foo" is requested. + (Brian Degenhardt) Changes to Squid-2.4.DEVEL4 (): diff --git a/src/internal.cc b/src/internal.cc index 774c5977a6..c8b56d017d 100644 --- a/src/internal.cc +++ b/src/internal.cc @@ -1,6 +1,6 @@ /* - * $Id: internal.cc,v 1.19 2000/11/13 12:25:12 adrian Exp $ + * $Id: internal.cc,v 1.20 2000/11/15 13:01:54 adrian Exp $ * * DEBUG: section 76 Internal Squid Object handling * AUTHOR: Duane, Alex, Henrik @@ -98,8 +98,15 @@ internalRemoteUri(const char *host, u_short port, const char *dir, const char *n static char lc_host[SQUIDHOSTNAMELEN]; assert(host && port && name); /* convert host name to lower case */ - xstrncpy(lc_host, host, sizeof(lc_host)); + xstrncpy(lc_host, host, SQUIDHOSTNAMELEN - 1); Tolower(lc_host); + /* + * append the domain in order to mirror the requests with appended + * domains + */ + if (Config.appendDomain && !strchr(lc_host, '.')) + strncat(lc_host, Config.appendDomain, SQUIDHOSTNAMELEN - + strlen(lc_host) - 1); /* build uri in mb */ memBufReset(&mb); memBufPrintf(&mb, "http://%s", lc_host);