It's right procedure, but I pass wrong URL path. Hopefully it's helpful to
you when using pac file.

Thanks for reading and sharing,

John
"John" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I am running into the issue to extract proxy from PAC file. My code is
able
> to work on some situations ie isInNet(), but for dnsDomainIs() it cannot
> resolve. Could anyone point me what's the issue here? Thanks very much.
>
> Explaination: in my pac file, even I pointed my host to 10.11.xxx.xxx,
which
> belongs xxx.net domain. I expect it reutrn fun3(). but it always faile and
> return DIRECT --the last "else" condition.
>
> code snippet:
>  var
>
ios=Components.classes["@mozilla.org/network/io-service;1"].getService(Compo
> nents.interfaces.nsIIOService);
>  var URI = ios.newURI("my url for pac file", null, null);
>  var ProxyAutoConfig;
>
>
ProxyAutoConfig=Components.classes["@mozilla.org/network/proxy-auto-config;1
> "].createInstance(Components.interfaces.nsIProxyAutoConfig);
>  var strProxyPac = ProxyAutoConfig.getProxyForURI(URI);
>
> Here is PAC file:
>
> function fun1(url, host) { return "PROXY 10.64.3.21:8080";  }
> function fun2(url, host) { return "PROXY 10.64.3.1:3128"; }
> function fun3(url, host) { return "PROXY 10.11.25.2:3128"; }
> function fun4(url, host) { return "PROXY xxx.xxx.xxx.xxx:8080"; }
>
> function FindProxyForURL(url, host)
> {
>  if (isInNet(host, "10.12.0.0", "255.255.0.0"))
>  {
>  return fun1(url, host);
>  }
>
> //which is condition should be TRUE
> else if (dnsDomainIs(host, ".xxx.net"))
>  {
>  return fun3(url, host);
>  }
>
>
>  else if (dnsDomainIs(host, ".sun.com"))
> {
>   return fun4(url, host);
> }
>  else
>  return "DIRECT";
>
> }
>
>
>


_______________________________________________
Mozilla-netlib mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-netlib

Reply via email to