File squid-3.1-10236.patch of Package squid3.import5582

------------------------------------------------------------
revno: 10236
revision-id: squid3@treenet.co.nz-20110322120426-c9s526a1h04bbsyb
parent: squid3@treenet.co.nz-20110318124447-2ghmsj62b388oyfk
fixes bug(s): http://bugs.squid-cache.org/show_bug.cgi?id=2976
committer: Amos Jeffries <squid3@treenet.co.nz>
branch nick: SQUID_3_1
timestamp: Tue 2011-03-22 06:04:26 -0600
message:
  Bug 2976: invalid URL on intercepted requests during reconfigure
  
  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.
------------------------------------------------------------
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: squid3@treenet.co.nz-20110322120426-c9s526a1h04bbsyb
# target_branch: http://www.squid-cache.org/bzr/squid3/trunk/
# testament_sha1: 8b61111eebb394744e9f29b0cc61c0409cf1701a
# timestamp: 2011-03-22 12:11:40 +0000
# source_branch: http://bzr.squid-cache.org/bzr/squid3/branches\
#   /SQUID_3_1
# base_revision_id: squid3@treenet.co.nz-20110318124447-\
#   2ghmsj62b388oyfk
# 
# Begin patch
=== modified file 'src/client_side.cc'
--- src/client_side.cc	2011-02-01 01:50:29 +0000
+++ src/client_side.cc	2011-03-22 12:04:26 +0000
@@ -1875,21 +1875,21 @@
         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 << "'");
     }