]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed the internal URL code to obey appendDomain for internal
authoradrian <>
Wed, 15 Nov 2000 20:01:53 +0000 (20:01 +0000)
committeradrian <>
Wed, 15 Nov 2000 20:01:53 +0000 (20:01 +0000)
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 <bmd@mp3.com>

ChangeLog
src/internal.cc

index 51997bef18ceecbe934fdd07d7195e4cc5dc48fc..ea1260d3ca94e37a90cd58e3a8a8ef7df5cc6226 100644 (file)
--- 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 ():
 
index 774c5977a64e7db7d62bc9c87f3e61109e24d8ac..c8b56d017dea169a96e47ce8687a3db8b78939d5 100644 (file)
@@ -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);