From: wessels <> Date: Thu, 20 Feb 1997 00:05:21 +0000 (+0000) Subject: Move append_domain operation to urlParse(). Use Config.appendDomainLen X-Git-Tag: SQUID_3_0_PRE1~5109 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ba0fd1b602f60459d0ca0311e553ee3395a5f33a;p=thirdparty%2Fsquid.git Move append_domain operation to urlParse(). Use Config.appendDomainLen to make extra room in URL buffers. --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 7729508611..868521677e 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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; } diff --git a/src/url.cc b/src/url.cc index c6d3c52a28..8b3aab5936 100644 --- a/src/url.cc +++ b/src/url.cc @@ -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;