Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

better/new proxy auto config

lotus61d9e131b44c
diff --git a/htroot/autoconfig.java b/htroot/autoconfig.java
index 86a30a406..bfdf7a7e1 100644
--- a/htroot/autoconfig.java
+++ b/htroot/autoconfig.java
@@ -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>
diff --git a/htroot/autoconfig.pac b/htroot/autoconfig.pac
index adb138b3d..5ed509536 100644
--- a/htroot/autoconfig.pac
+++ b/htroot/autoconfig.pac
@@ -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";
}
\ No newline at end of file