]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2976: invalid URL on intercepted requests during reconfigure
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 22 Mar 2011 12:04:26 +0000 (06:04 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 22 Mar 2011 12:04:26 +0000 (06:04 -0600)
Listening ports abuse the cbdata type as a pseudo refcount. This breaks
during reconfigure when the config is erased and the active requests
handles all become invalid pointers.

Interception only works on HTTP protocol. We can hard-code the scheme
and avoid this problem until a complete fix is written.

src/client_side.cc

index 49e4a36899093374e4cbfd163e525f40a662605f..9d42444744003224d9431256ac7577c620b6b0c5 100644 (file)
@@ -1875,21 +1875,21 @@ prepareTransparentURL(ConnStateData * conn, ClientHttpRequest *http, char *url,
         return; /* already in good shape */
 
     /* BUG: Squid cannot deal with '*' URLs (RFC2616 5.1.2) */
+    // BUG 2976: Squid only accepts intercepted HTTP.
 
     if ((host = mime_get_header(req_hdr, "Host")) != NULL) {
         int url_sz = strlen(url) + 32 + Config.appendDomainLen +
                      strlen(host);
         http->uri = (char *)xcalloc(url_sz, 1);
-        snprintf(http->uri, url_sz, "%s://%s%s",
-                 conn->port->protocol, host, url);
+        snprintf(http->uri, url_sz, "http://%s%s", /*conn->port->protocol,*/ host, url);
         debugs(33, 5, "TRANSPARENT HOST REWRITE: '" << http->uri <<"'");
     } else {
         /* Put the local socket IP address as the hostname.  */
         int url_sz = strlen(url) + 32 + Config.appendDomainLen;
         http->uri = (char *)xcalloc(url_sz, 1);
         http->getConn()->me.ToHostname(ipbuf,MAX_IPSTRLEN),
-        snprintf(http->uri, url_sz, "%s://%s:%d%s",
-                 http->getConn()->port->protocol,
+        snprintf(http->uri, url_sz, "http://%s:%d%s",
+                 // http->getConn()->port->protocol,
                  ipbuf, http->getConn()->me.GetPort(), url);
         debugs(33, 5, "TRANSPARENT REWRITE: '" << http->uri << "'");
     }