Fixes for 79057 submitted by tingley@sundell.net, r=bbaetz, sr=darin, a=asa@mozilla.org

This commit is contained in:
serge%netscape.com 2001-07-30 22:22:27 +00:00
parent 78858a026b
commit ce553ea222

View File

@ -115,6 +115,7 @@ nsProxyAutoConfig.prototype = {
// see bugs 80363 and 92516.
ProxySandBox.myIP = "127.0.0.1";
}
ProxySandBox.dnsResolve = dnsResolve;
LocalFindProxyForURL=ProxySandBox.FindProxyForURL;
},
@ -124,6 +125,16 @@ nsProxyAutoConfig.prototype = {
}
}
// wrapper for dns.resolve to catch exception on failure
function dnsResolve(host) {
try {
var ip = dns.resolve(host);
return ip;
}
catch (e) {}
return null;
}
var pacModule = new Object();
pacModule.registerSelf =
@ -198,6 +209,8 @@ var pacUtils =
" var test = /^(\\d{1,4})\\.(\\d{1,4})\\.(\\d{1,4})\\.(\\d{1,4})$/(ipaddr);\n"+
" if (test == null) {\n"+
" ipaddr = dnsResolve(ipaddr);\n"+
" if (ipaddr == null)\n"+
" return false;\n"+
" } else if (test[1] > 255 || test[2] > 255 || \n"+
" test[3] > 255 || test[4] > 255) {\n"+
" return false; // not an IP address\n"+