While investigating bug 2976 (URLs suddenly becoming (null)://foo/ on
intercepted traffic for a few seconds) it has become clear that the
listening ports are badly abusing cbdata.
They *are* passed as cbdata parameters from IPC to the connection
accepting routines. However the parser is not aware of their cbdata'ness
and is using new/delete directly on the config pointers.
Long term I think the right solution is to RefCount the http_port_list
object. Since their main property seems to be that the ConnStateData
retain a long-term pointers to them despite SquidConfig disappearing.
As a short-term workaround just for interception ports. It appears that
we can hard-code the scheme. Since interception can only be done with
HTTP protocol.
Barring objections I'll commit this short-term workaround in a few
days.
Amos
=== modified file 'src/client_side.cc'
--- src/client_side.cc 2011-03-02 07:27:24 +0000
+++ src/client_side.cc 2011-03-02 20:54:41 +0000
@@ -2016,21 +2016,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 << "'");
}