RE: [squid-users] Timeouts/browser hang with "autodetect proxy"

From: David Gameau <David.Gameau@dont-contact.us>
Date: Fri, 9 Mar 2007 12:19:29 +1030

> -----Original Message-----
> From: Adrian Chadd [mailto:adrian@creative.net.au]
> Sent: Friday, 9 March 2007 10:35 AM
> To: Brian Riffle
> Subject: Re: [squid-users] Timeouts/browser hang with
> "autodetect proxy"
>
> On Thu, Mar 08, 2007, Brian Riffle wrote:
> > I am having an issue with timeouts using squid with both IE and
> > Firefox when using "auto detect proxy" When I am autodetecting the
> > proxy server, if I type in an invalid domain name (like google.comm,
> > or googlec.om, etc) it will take upwards of 20 seconds to
> timeout, and
>
> Two things:
>
> Firstly, time how long it takes the configured DNS servers to resolve
> an invalid name like googlec.om; see how long it takes.
> See if its even giving a reply!
>
> Then I'd check these rules out:
>
> > if (isInNet(host, "192.168.5.0", "255.255.255.0")) {return
> > "DIRECT";}
> > if (isInNet(host, "192.168.42.0", "255.255.255.0"))
> {return
>
> .. etc;
>
> as this causes the browser to do a DNS lookup. I haven't looked into
> it to see whether DNS lookups are done for -each- of those isInNet()
> or whether its cached (which you'd kind of hope!)
>
> Adrian
>
>
From my experience, each isInNet() statement produces a separate DNS
lookup.
What you want to do is use isResolvable(host) before hand to
short-circuit
those steps.

For example (if you wanted unresolvable DNS lookups to be forwarded to
the
proxy, to generate a decent error page), you might use something like
this...

function FindProxyForURL(url, host)
{
  if ((isPlainHostName(host) ||
      (dnsDomainIs(host, ".example.com"))
    return "DIRECT";
  if (!isResolvable(host))
    return "PROXY proxy.example.com:3128";
  if ((isInNet(host, "192.168.0.0", "255.255.0.0") ||
      (isInNet(host, "169.254.0.0", "255.255.0.0") ||
      (isInNet(host, "10.0.0.0", "255.0.0.0"))
    return "DIRECT";

  return "PROXY proxy.example.com:3128";
}

Regards,
David.
__

David Gameau
ISTS - Systems Infrastructure
University of South Australia

email: David.Gameau@UniSA.edu.au
phone: +61 8 302 3533
fax: +61 8 302 5800

Disclaimer: "His brain sometimes stops working." - Chiyo, Azumange Daoih
Received on Thu Mar 08 2007 - 18:49:39 MST

This archive was generated by hypermail pre-2.1.9 : Sat Mar 31 2007 - 13:00:01 MDT