From: hno <> Date: Mon, 12 Feb 2001 03:06:15 +0000 (+0000) Subject: Cleanup of how "httpd_accel_port virtual" is handled. Now httpd_accel_port X-Git-Tag: SQUID_3_0_PRE1~1602 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4045776774dd3291af0095591307e13388915ee8;p=thirdparty%2Fsquid.git Cleanup of how "httpd_accel_port virtual" is handled. Now httpd_accel_port is always (for accelerated request) used if it is set, and if virtual then the port number is retreived from a) Host header (when httpd_accel_uses_host_header is on) b) Transparent redirection/NAT lookup c) Local endpoint of the socket Previosly is was a mix where some always overrode httpd_accel_port, and in some cases virtual was even ignored causing a port number of 0.. --- diff --git a/src/client_side.cc b/src/client_side.cc index bf75c22dc1..79f7ed6864 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.525 2001/02/09 19:35:11 hno Exp $ + * $Id: client_side.cc,v 1.526 2001/02/11 20:06:15 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2436,8 +2436,12 @@ parseHttpRequest(ConnStateData * conn, method_t * method_p, int *status, else if (Config2.Accel.on && *url == '/') { /* prepend the accel prefix */ if (opt_accel_uses_host && (t = mime_get_header(req_hdr, "Host"))) { - int vport = (int) Config.Accel.port; + int vport; char *q; + if (vport_mode) + vport = (int) ntohs(http->conn->me.sin_port); + else + vport = (int) Config.Accel.port; /* If a Host: header was specified, use it to build the URL * instead of the one in the Config file. */ /* @@ -2450,7 +2454,8 @@ parseHttpRequest(ConnStateData * conn, method_t * method_p, int *status, strtok(t, " /;@"); if ((q = strchr(t, ':'))) { *q++ = '\0'; - vport = atoi(q); + if (vport_mode) + vport = atoi(q); } url_sz = strlen(url) + 32 + Config.appendDomainLen + strlen(t); @@ -2503,6 +2508,8 @@ parseHttpRequest(ConnStateData * conn, method_t * method_p, int *status, inet_ntoa(http->conn->me.sin_addr), vport, url); } else + if (vport_mode) + vport = natLookup.nl_realport; snprintf(http->uri, url_sz, "http://%s:%d%s", inet_ntoa(natLookup.nl_realip), vport, url); @@ -2511,6 +2518,8 @@ parseHttpRequest(ConnStateData * conn, method_t * method_p, int *status, /* If the call fails the address structure will be unchanged */ getsockopt(conn->fd, SOL_IP, SO_ORIGINAL_DST, &conn->me, &sock_sz); debug(33, 5) ("parseHttpRequest: addr = %s", inet_ntoa(conn->me.sin_addr)); + if (vport_mode) + vport = (int) ntohs(http->conn->me.sin_port); #endif snprintf(http->uri, url_sz, "http://%s:%d%s", inet_ntoa(http->conn->me.sin_addr),