2005-04-15 11:06:15 +02:00
|
|
|
function FindProxyForURL(url,host) {
|
2009-06-15 21:48:11 +02:00
|
|
|
#(yacy)#
|
|
|
|
// .yacy only
|
|
|
|
if(shExpMatch(host,"*.yacy")) {
|
|
|
|
return "PROXY #[host]#:#[port]#, DIRECT";
|
|
|
|
}
|
|
|
|
return "DIRECT";
|
|
|
|
::
|
2009-06-02 14:18:29 +02:00
|
|
|
// http only
|
|
|
|
if (!(url.substring(0, 5).toLowerCase() == "http:")) {
|
2005-09-30 09:47:28 +02:00
|
|
|
return "DIRECT";
|
2009-06-02 14:18:29 +02:00
|
|
|
}
|
|
|
|
|
2009-06-03 21:03:03 +02:00
|
|
|
// not the proxy itself
|
|
|
|
if (host == "#[host]#") return "DIRECT";
|
|
|
|
|
2009-06-02 14:18:29 +02:00
|
|
|
// 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";
|
|
|
|
}
|
|
|
|
|
2009-06-03 21:03:03 +02:00
|
|
|
// not the proxy itself (better: dnsResolve(#[host]#), but an additional lookup)
|
|
|
|
if (ip == "#[host]#") return "DIRECT";
|
|
|
|
|
2009-06-02 14:18:29 +02:00
|
|
|
// then
|
|
|
|
return "PROXY #[host]#:#[port]#, DIRECT";
|
2009-06-15 21:48:11 +02:00
|
|
|
#(/yacy)#
|
2005-04-15 11:06:15 +02:00
|
|
|
}
|