better/new proxy auto config

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6010 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
lotus 16 years ago
parent 0d44a6d503
commit 61d9e131b4

@ -30,6 +30,7 @@ import de.anomic.server.serverSwitch;
public class autoconfig {
// http://web.archive.org/web/20071011034022/http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html
/**
* Generates a proxy-autoconfig-file (application/x-ns-proxy-autoconfig)
* See: <a href="http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html">Proxy Auto-Config File Format</a>

@ -1,10 +1,18 @@
function FindProxyForURL(url,host) {
if ((isPlainHostName(host))||
(host=="127.0.0.1")) {
return "DIRECT";
} else if (url.substring(0, 4).toLowerCase() == "ftp:") {
// http only
if (!(url.substring(0, 5).toLowerCase() == "http:")) {
return "DIRECT";
} else {
return "PROXY #[host]#:#[port]#, 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";
}
// then
return "PROXY #[host]#:#[port]#, DIRECT";
}
Loading…
Cancel
Save