Re: Automatic Proxy Config scripts

From: Penisoara Adrian <>
Date: Wed, 7 May 1997 18:08:37 +0300 (EEST)


On Wed, 7 May 1997, Thomas Anders wrote:

> Hi,
> [regarding your mail to the squid users mailing list]
> My proxy.pac script is quite the same as yours except one little thing ...
> --- snip ---
> // Is it the 'localhost' alias ?
> if( shExpMatch(host,"localhost.*") ||
> shExpMatch(host,"") )
> return "DIRECT";
> --- snap ---
> Should it really be "localhost.*"? Shouldn't it be "localhost*" (without
> dot) to support 'localhost' without domain?
Well, I think this should be so for 2 reasons:
1). Before we check for "localhost.*" there is another check:

 // Is it a plain hostname ?
  return "DIRECT";

 // Is it the 'localhost' alias ?
 if( shExpMatch(host,"localhost.*") ||
     shExpMatch(host,"") )
  return "DIRECT";
 So, before that we check if the host isn't just a plain simple hostname
(like 'www', 'foo' or _'localhost'_); so we exclude the local alias
'localhost' anyway.

2). Is it "localhost.*" and not "localhost*" for there might be some
really odd addresses like "localhost-test" or, even worse,
"". Also this is beacause when a simple host
name is given in an URL (e.g. 'http://localhost/foo/') usually there are
done DNS lookups for both 'localhost' and 'localhost.your.domain' where
'your.domain' is the string to be appended for addressed without dots (aka
the 'domain' directive in your /etc/resolv.conf).

If I am wrong somewhere, please do report it!

Please note that anyway some local addresses may escape these
verifications. The DNS permits something like
'foo IN A' in a SOA record for a zone,
meaning that foo.the.domain will have the IP ! That's why
sometimes the isInNet() call is better for it does an DNS lookup for
the specified host...

> Regards,
> Thomas
> --
> Thomas Anders <>
> Hahn-Meitner-Institute Berlin, Germany

RGDS, Ady (
Received on Wed May 07 1997 - 08:12:30 MDT

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