You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
743 B
24 lines
743 B
function FindProxyForURL(url,host) {
|
|
// http only
|
|
if (!(url.substring(0, 5).toLowerCase() == "http:")) {
|
|
return "DIRECT";
|
|
}
|
|
|
|
// not the proxy itself
|
|
if (host == "#[host]#") return "DIRECT";
|
|
|
|
// no local adresses
|
|
ip = dnsResolve(host);
|
|
if ( isInNet(ip, "127.0.0.0", "255.0.0.0")
|
|
|| isInNet(ip, "192.168.0.0", "255.255.0.0")
|
|
|| isInNet(ip, "10.0.0.0", "255.0.0.0")
|
|
|| isInNet(ip, "172.16.0.0", "255.240.0.0") ) {
|
|
return "DIRECT";
|
|
}
|
|
|
|
// not the proxy itself (better: dnsResolve(#[host]#), but an additional lookup)
|
|
if (ip == "#[host]#") return "DIRECT";
|
|
|
|
// then
|
|
return "PROXY #[host]#:#[port]#, DIRECT";
|
|
} |