]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Move append_domain operation to urlParse(). Use Config.appendDomainLen
authorwessels <>
Thu, 20 Feb 1997 00:05:21 +0000 (00:05 +0000)
committerwessels <>
Thu, 20 Feb 1997 00:05:21 +0000 (00:05 +0000)
to make extra room in URL buffers.

src/cache_cf.cc
src/url.cc

index 772950861100eb7b7095f7fae944bb6e7137fd0b..868521677ebe77137e9aa4a2eefc46a3d4ec5123 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cache_cf.cc,v 1.171 1997/02/06 18:44:23 wessels Exp $
+ * $Id: cache_cf.cc,v 1.172 1997/02/19 17:05:21 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -1598,4 +1598,8 @@ configDoConfigure(void)
        SQUID_VERSION);
     if (!Config.udpMaxHitObjsz || Config.udpMaxHitObjsz > SQUID_UDP_SO_SNDBUF)
        Config.udpMaxHitObjsz = SQUID_UDP_SO_SNDBUF;
+    if (Config.appendDomain)
+       Config.appendDomainLen = strlen(Config.appendDomain);
+    else
+       Config.appendDomainLen = 0;
 }
index c6d3c52a284b92ac03e88f5588ef3c1f197f7673..8b3aab5936d6f75fc84ef81a89dfe9ae36f80eac 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: url.cc,v 1.53 1997/02/19 00:03:48 wessels Exp $
+ * $Id: url.cc,v 1.54 1997/02/19 17:05:24 wessels Exp $
  *
  * DEBUG: section 23    URL Parsing
  * AUTHOR: Duane Wessels
@@ -207,7 +207,7 @@ urlParse(method_t method, char *url)
     int l;
     proto[0] = host[0] = urlpath[0] = login[0] = '\0';
 
-    if ((l = strlen(url)) > (MAX_URL - 1)) {
+    if ((l = strlen(url)) + Config.appendDomainLen > (MAX_URL - 1)) {
        /* terminate so it doesn't overflow other buffers */
        *(url + (MAX_URL >> 1)) = '\0';
        debug(23, 0, "urlParse: URL too large (%d bytes)\n", l);
@@ -240,6 +240,8 @@ urlParse(method_t method, char *url)
     /* remove trailing dots from hostnames */
     while ((l = strlen(host)) && host[--l] == '.')
        host[l] = '\0';
+    if (Config.appendDomain && !strchr(host, '.'))
+       strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN);
     if (port == 0) {
        debug(23, 0, "urlParse: Invalid port == 0\n");
        return NULL;