diff --git a/defaults/yacy.init b/defaults/yacy.init index 93f3fd8b7..a77f13a50 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -515,6 +515,9 @@ proxyIndexingRemote=false proxyIndexingLocalText=true proxyIndexingLocalMedia=true +# proxy usage only for .yacy-Domains for autoconfig +proxyYacyOnly=false + # From the 'IndexCreate' menu point you can also define a crawling start point. # The crawling works the same way as the prefetch, but it is possible to # assign a different crawling depth. diff --git a/htroot/ProxyIndexingMonitor_p.html b/htroot/ProxyIndexingMonitor_p.html index f7de46b2b..7cd786a5f 100644 --- a/htroot/ProxyIndexingMonitor_p.html +++ b/htroot/ProxyIndexingMonitor_p.html @@ -18,6 +18,19 @@
+ + + + + + + + +
Proxy Auto Config: + this controls the proxy auto configuration script for browsers at http://localhost:8080/autoconfig.pac +
+ whether the proxy should only be used for .yacy-Domains +
Proxy pre-fetch setting: this is an automated html page loading procedure that takes actual proxy-requested diff --git a/htroot/ProxyIndexingMonitor_p.java b/htroot/ProxyIndexingMonitor_p.java index e7f7917c4..cba9b4bb4 100644 --- a/htroot/ProxyIndexingMonitor_p.java +++ b/htroot/ProxyIndexingMonitor_p.java @@ -63,6 +63,8 @@ public class ProxyIndexingMonitor_p { if (post.containsKey("proxyprofileset")) try { // read values and put them in global settings + final boolean proxyYaCyOnly = post.containsKey("proxyYacyOnly"); + env.setConfig(plasmaSwitchboardConstants.PROXY_YACY_ONLY, (proxyYaCyOnly) ? "true" : "false"); int newProxyPrefetchDepth = post.getInt("proxyPrefetchDepth", 0); if (newProxyPrefetchDepth < 0) newProxyPrefetchDepth = 0; if (newProxyPrefetchDepth > 20) newProxyPrefetchDepth = 20; // self protection ? @@ -147,6 +149,8 @@ public class ProxyIndexingMonitor_p { } } + final boolean yacyonly = env.getConfigBool(plasmaSwitchboardConstants.PROXY_YACY_ONLY, false); + prop.put("proxyYacyOnly", yacyonly ? "1" : "0"); prop.put("proxyPrefetchDepth", env.getConfigLong("proxyPrefetchDepth", 0)); prop.put("proxyStoreHTCacheChecked", env.getConfig("proxyStoreHTCache", "").equals("true") ? "1" : "0"); prop.put("proxyIndexingRemote", env.getConfig("proxyIndexingRemote", "").equals("true") ? "1" : "0"); diff --git a/htroot/autoconfig.java b/htroot/autoconfig.java index bfdf7a7e1..7d61e86d9 100644 --- a/htroot/autoconfig.java +++ b/htroot/autoconfig.java @@ -25,6 +25,7 @@ //if the shell's current path is HTROOT import de.anomic.http.httpRequestHeader; +import de.anomic.plasma.plasmaSwitchboardConstants; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; @@ -43,6 +44,8 @@ public class autoconfig { final serverObjects prop = new serverObjects(); + final boolean yacyonly = env.getConfigBool(plasmaSwitchboardConstants.PROXY_YACY_ONLY, false); + // getting the http host header final String hostSocket = header.get(httpRequestHeader.CONNECTION_PROP_HOST); @@ -54,8 +57,9 @@ public class autoconfig { host = hostSocket.substring(0, pos); } - prop.put("host", host); - prop.put("port", port); + prop.put("yacy", yacyonly ? "0" : "1"); + prop.put("yacy_host", host); + prop.put("yacy_port", port); return prop; } diff --git a/htroot/autoconfig.pac b/htroot/autoconfig.pac index 435e4587c..efb3860a1 100644 --- a/htroot/autoconfig.pac +++ b/htroot/autoconfig.pac @@ -1,4 +1,11 @@ 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"; @@ -21,4 +28,5 @@ function FindProxyForURL(url,host) { // then return "PROXY #[host]#:#[port]#, DIRECT"; +#(/yacy)# } \ No newline at end of file diff --git a/source/de/anomic/plasma/plasmaSwitchboardConstants.java b/source/de/anomic/plasma/plasmaSwitchboardConstants.java index 35849e561..d983fd360 100644 --- a/source/de/anomic/plasma/plasmaSwitchboardConstants.java +++ b/source/de/anomic/plasma/plasmaSwitchboardConstants.java @@ -277,6 +277,7 @@ public final class plasmaSwitchboardConstants { * @see plasmaSwitchboard#PROXY_CACHE_LAYOUT_TREE * @see plasmaSwitchboard#PROXY_CACHE_LAYOUT_HASH */ + public static final String PROXY_YACY_ONLY = "proxyYacyOnly"; ////////////////////////////////////////////////////////////////////////////////////////////// // Cluster settings