From: Amos Jeffries Date: Mon, 25 Jul 2011 22:23:39 +0000 (-0600) Subject: Regression fix: vhost and defaultsite causing vport to be ignored X-Git-Tag: SQUID_3_1_15~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=005987cd5ec70d6db767582af988d4bcaeb148e0;p=thirdparty%2Fsquid.git Regression fix: vhost and defaultsite causing vport to be ignored Instead of dropping it completely we should be sanely combining them like Squid-2 does for most cases. This appears to have been lost while removing the getmyHostname() from the process and reducing the prepareTransparentUrl code. This fix makes vport apply even if vhost was used. It will modify the Host: header contents according to the documented vport semantics. This fix makes vport apply even if defaultsite= was used. It will append the specified port to the domain name given. Domains with port attached are not supported and will produce invalid URLs. TODO: detect this case while parsing the initial config and warn. --- 005987cd5ec70d6db767582af988d4bcaeb148e0 diff --cc src/client_side.cc index c68564159d,a91a12c4bd..e19edf06f7 --- a/src/client_side.cc +++ b/src/client_side.cc @@@ -1874,6 -1874,9 +1874,9 @@@ prepareAcceleratedURL(ConnStateData * c return; } + if (vport < 0) - vport = http->getConn()->me->local.GetPort(); ++ vport = http->getConn()->me.GetPort(); + const bool switchedToHttps = conn->switchedToHttps(); const bool tryHostHeader = vhost || switchedToHttps; if (tryHostHeader && (host = mime_get_header(req_hdr, "Host")) != NULL) { @@@ -2140,6 -2155,7 +2155,7 @@@ parseHttpRequest(ConnStateData *conn, H #endif - debugs(33,5, HERE << "repare absolute URL from " << (csd->transparent()?"intercept":(csd->port->accel ? "accel":""))); ++ debugs(33,5, HERE << "repare absolute URL from " << (conn->transparent()?"intercept":(conn->port->accel ? "accel":""))); /* Rewrite the URL in transparent or accelerator mode */ /* NP: there are several cases to traverse here: * - standard mode (forward proxy)