On Mon, Sep 04, 2006 at 09:28:33PM +1000, Erik de Castro Lopo wrote:
> Ben Buxton wrote:
> 
> > Erik de Castro Lopo <[EMAIL PROTECTED]> uttered the following thing:
> > > 
> > >     function FindProxyForURL(url, host)
> > >     {
> > 
> > I was hacking a pac file sometime back and discovered that under Linux
> > you're gonna have pot luck as to whether it works.
> > 
> > It seems that it's pretty arbitrary as to which interface it probes to
> > fetch the IP address. And more often than not, it looks at the loopback
> > interface!
> 
> Well that would certainly explain it. Its still borked but 
> explainable.

I'd avoid isInNet anyway in favour of shExpMatch because isInNet
does dns lookups. And this function will be done for every http
connection afaik. Could be slow!

So I'd try something like

function FindProxyForURL(url, host)
{
        if (shExpMatch (myIpAddress(), "192.168.18.*"))
                return "DIRECT";

        if (shExpMatch (myIpAddress(), "192.168.12.*"))
                return "PROXY 192.168.12.101:3128" ;

        return "DIRECT";
}

hopefully myIpAddress() would be properly stringified;
I know barely enough javascript to be dangerous.

Matt


-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to