mirror of
https://github.com/yacy/yacy_search_server.git
synced 2025-01-22 05:08:42 -05:00
aec3e7995a
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6077 6c8d7289-2bf4-0310-a012-ef5d649a1542
32 lines
904 B
JavaScript
32 lines
904 B
JavaScript
function FindProxyForURL(url,host) {
|
|
#(yacy)#
|
|
// .yacy only
|
|
if(shExpMatch(host,"*.yacy")) {
|
|
return "PROXY #[host]#:#[port]#, DIRECT";
|
|
}
|
|
return "DIRECT";
|
|
::
|
|
// 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";
|
|
#(/yacy)#
|
|
} |