From 4db73ee0154be328239625e88612718b098f381f Mon Sep 17 00:00:00 2001 From: auron_x Date: Mon, 11 Jun 2007 15:19:06 +0000 Subject: [PATCH] *) added possibility to test if a certain URL is blacklisted git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3863 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Blacklist_p.html | 22 ++++++++++++++++++++++ htroot/Blacklist_p.java | 30 +++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/htroot/Blacklist_p.html b/htroot/Blacklist_p.html index 39cbed8e0..0d8c4af34 100644 --- a/htroot/Blacklist_p.html +++ b/htroot/Blacklist_p.html @@ -18,6 +18,28 @@

Active list: #(disabled)##[currentBlacklist]#::No blacklist selected#(/disabled)#

+
+ Test list: +
+   + + + #(testlist)#:: +
+ The tested URL was #[url]#
+ It is blocked for the following cases:
+
    + #(listedincrawler)#::
  • Crawling
  • #(/listedincrawler)# + #(listedindht)#::
  • DHT
  • #(/listedindht)# + #(listedinnews)#::
  • News
  • #(/listedinnews)# + #(listedinproxy)#::
  • Proxy
  • #(/listedinproxy)# + #(listedinsearch)#::
  • Search
  • #(/listedinsearch)# + #(listedinsurftips)#::
  • Surftips
  • #(/listedinsurftips)# +
+
+ #(/testlist)# +
+
Select list:
#(disabled)# diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.java index e1820adcf..4ab355c9d 100644 --- a/htroot/Blacklist_p.java +++ b/htroot/Blacklist_p.java @@ -52,6 +52,7 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; @@ -59,8 +60,10 @@ import java.util.TreeMap; import de.anomic.data.listManager; import de.anomic.http.httpHeader; +import de.anomic.net.URL; import de.anomic.plasma.plasmaSwitchboard; import de.anomic.plasma.urlPattern.abstractURLPattern; +import de.anomic.plasma.urlPattern.plasmaURLPattern; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.yacy.yacyCore; @@ -88,7 +91,32 @@ public class Blacklist_p { // do all post operations if (post != null) { - if (post.containsKey("selectList")) { + if(post.containsKey("testList")) { + prop.put("testlist",1); + String urlstring = post.get("testurl", ""); + if(!urlstring.startsWith("http://")) urlstring = "http://"+urlstring; + URL testurl = null; + try { + testurl = new URL(urlstring); + } catch (MalformedURLException e) { } + if(testurl != null) { + prop.put("testlist_url",testurl.toString()); + if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_CRAWLER, testurl)) + prop.put("testlist_listedincrawler",1); + if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_DHT, testurl)) + prop.put("testlist_listedindht",1); + if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_NEWS, testurl)) + prop.put("testlist_listedinnews",1); + if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_PROXY, testurl)) + prop.put("testlist_listedinproxy",1); + if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_SEARCH, testurl)) + prop.put("testlist_listedinsearch",1); + if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_SURFTIPS, testurl)) + prop.put("testlist_listedinsurftips",1); + } + else prop.put("testlist_url","not valid"); + } + if (post.containsKey("selectList")) { blacklistToUse = (String)post.get("selectedListName"); if (blacklistToUse != null && blacklistToUse.length() == 0) blacklistToUse = null; }