I use a PAC file at work for proxy configuration with Mozilla.
There appears to be one line in this file that fails with Mozilla.
It is
if (dnsDomainIs(host, ".xx.com") && isInNet(host,"15.0.0.0","255.0.0.0"))
return "DIRECT";
This is one of the first conditions in my configuration file and the
ones above it do not match for "xx.com" or "15.0.0.0". The default is to use
PROXY.
So if I try to go to http://directory.xx.com it will try to use the
proxy (default case) instead of direct. I verified that
http://directory.xx.com is in the 15.0.0.0 subnet.
So...I decided to look at the mozilla code, specifically how
dnsDomainIs() is implemented
Below is the relevant code (from lxr.mozilla.org)....
http://lxr.mozilla.org/mozilla/source/n ... oConfig.js :
"function dnsDomainIs(host, domain) {\n" +
242 " return (host.length >= domain.length &&\n" +
243 " host.substring(host.length - domain.length) ==
domain);\n" +
244 "}\n" +
Now my question is...why is the argument to host.substring()
"host.length - domain.length" ? We are trying to match the domain
argument and it would be logical to search for a substring with the
same length as domain.
So it should be:
"function dnsDomainIs(host, domain) {\n" +
return (host.length >= domain.length &&\n" +
host.substring(domain.length) == domain);\n"
Does this make sense? Or is my PAC file incorrect?
-Jerry
Autoconfig Proxy (PAC) issue
-
- Posts: 62
- Joined: November 12th, 2002, 10:09 pm
Re: Autoconfig Proxy (PAC) issue
mr_brown wrote:
http://lxr.mozilla.org/mozilla/source/n ... oConfig.js :
"function dnsDomainIs(host, domain) {\n" +
242 " return (host.length >= domain.length &&\n" +
243 " host.substring(host.length - domain.length) ==
domain);\n" +
244 "}\n" +
Now my question is...why is the argument to host.substring()
"host.length - domain.length" ? We are trying to match the domain
argument and it would be logical to search for a substring with the
same length as domain.
So it should be:
"function dnsDomainIs(host, domain) {\n" +
return (host.length >= domain.length &&\n" +
host.substring(domain.length) == domain);\n"
Does this make sense? Or is my PAC file incorrect?
Good research, but, I fear, faulty reasoning. The first argument to substring is not the length of the substring, but the index of the start character (ie, host.substring(0) == host). Since, as you say, we want the length of the substring to be the same as the length of the domain, we do want (host.length - domain.length).
Thus I think the problem is probably with your PAC file. Maybe you could post it if you are still having problems?