Re: Transparent Proxy

From: Miquel van Smoorenburg <[email protected]>
Date: 17 Jan 1998 12:46:44 +0100

In article <34C00B75.4398D4FA@hem.passagen.se>,
Henrik Nordstrom <hno@hem.passagen.se> wrote:
>joe shmo wrote:
>
>> "this technique has several significant shortcomings!
>> 2.Instead it prints raw IP addresses. This is because the destination
>> address is determined with the getsockname(2) system call. This means the
>> use of a parent or sibling doesn't work correctly anymore. The parent or
>> sibling itself logs the URL by name not by IP address. These URLs are
>> different so no cache HIT occurs. This means that you lose the benefit of
>> reducing traffic in a caching hierarchy if you do transparent caching."
>
>This needs to be updated, and is not true. Transparent proxying should
>always use the Host: header if available. This requires a small patch to the
>current Squid sources (see a earlier message on this list), and the following
>options in squid.conf:
>http_accel virtual 80
>http_accel_uses_host_header on

I couldn't find the patch, but I know where to look as I was the
first one to hack it in in squid-1.1.9 or so. Would this be correct:

--- icp.c.orig Sat Jan 17 12:41:08 1998
+++ icp.c Sat Jan 17 12:42:59 1998
@@ -1683,16 +1683,7 @@
     /* see if we running in httpd_accel_mode, if so got to convert it to URL */
     if (httpd_accel_mode && *url == '/') {
         /* prepend the accel prefix */
- if (vhost_mode) {
- /* Put the local socket IP address as the hostname */
- url_sz = strlen(url) + 32 + Config.appendDomainLen;
- icpState->url = xcalloc(url_sz, 1);
- sprintf(icpState->url, "http://%s:%d%s",
- inet_ntoa(icpState->me.sin_addr),
- (int) Config.Accel.port,
- url);
- debug(12, 5, "VHOST REWRITE: '%s'\n", icpState->url);
- } else if (opt_accel_uses_host && (t = mime_get_header(req_hdr, "Host"))) {
+ if (opt_accel_uses_host && (t = mime_get_header(req_hdr, "Host"))) {
             /* If a Host: header was specified, use it to build the URL
              * instead of the one in the Config file. */
             /*
@@ -1707,6 +1698,16 @@
             icpState->url = xcalloc(url_sz, 1);
             sprintf(icpState->url, "http://%s:%d%s",
                 t, (int) Config.Accel.port, url);
+ if(vhost_mode) debug(12, 5, "VHOST REWRITE: '%s'\n", icpState->url);
+ } else if (vhost_mode) {
+ /* Put the local socket IP address as the hostname */
+ url_sz = strlen(url) + 32 + Config.appendDomainLen;
+ icpState->url = xcalloc(url_sz, 1);
+ sprintf(icpState->url, "http://%s:%d%s",
+ inet_ntoa(icpState->me.sin_addr),
+ (int) Config.Accel.port,
+ url);
+ debug(12, 5, "VHOST REWRITE: '%s'\n", icpState->url);
         } else {
             url_sz = strlen(Config.Accel.prefix) + strlen(url) +
                 Config.appendDomainLen + 1;

-- 
 Miquel van Smoorenburg |  The dyslexic, agnostic, insomniac lay in his bed
    miquels@cistron.nl  |  awake all night wondering if there is a doG
Received on Sat Jan 17 1998 - 04:05:41 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:38:27 MST