]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Regression fix: vhost and defaultsite causing vport to be ignored
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 25 Jul 2011 22:23:39 +0000 (16:23 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 25 Jul 2011 22:23:39 +0000 (16:23 -0600)
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.

1  2 
src/client_side.cc

index c68564159d9f21cc3a401e23d0ca3be27e7d8423,a91a12c4bdc46b3d615963f6249409e9b66fad0b..e19edf06f7c66dfe5736d43048d0c9c163884ab7
@@@ -1874,6 -1874,9 +1874,9 @@@ prepareAcceleratedURL(ConnStateData * c
          return;
      }
  
 -        vport = http->getConn()->me->local.GetPort();
+     if (vport < 0)
++        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)