From 1224d7408e1b4fc6715cc1cb577cb5e5bb8239e2 Mon Sep 17 00:00:00 2001 From: adrian <> Date: Wed, 15 Nov 2000 20:01:53 +0000 Subject: [PATCH] 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 --- ChangeLog | 4 ++++ src/internal.cc | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) 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); -- 2.47.3