- making blacklist path part case insensitive (solving http://bugs.yacy.net/view.php?id=171)

- blacklist test adding explicite response text "not blocked" if no blacklist match
pull/1/head
reger 12 years ago
parent e2d499be9e
commit e80dfeca23

@ -21,7 +21,7 @@
<br /><br />
<div>
The tested URL was #[url]#<br>
It is blocked for the following cases:<br>
#(isnotblocked)#It is blocked for the following cases:<br>::<br><b>is not blocked</b><br>#(/isnotblocked)#
<ul>
#(listedincrawler)#::<li>Crawling</li>#(/listedincrawler)#
#(listedindht)#::<li>DHT</li>#(/listedindht)#

@ -70,18 +70,36 @@ public class BlacklistTest_p {
if(testurl != null) {
prop.putHTML("url",testurl.toString());
prop.putHTML("testlist_url",testurl.toString());
if(Switchboard.urlBlacklist.isListed(BlacklistType.CRAWLER, testurl))
prop.put("testlist_listedincrawler", "1");
if(Switchboard.urlBlacklist.isListed(BlacklistType.DHT, testurl))
prop.put("testlist_listedindht", "1");
if(Switchboard.urlBlacklist.isListed(BlacklistType.NEWS, testurl))
prop.put("testlist_listedinnews", "1");
if(Switchboard.urlBlacklist.isListed(BlacklistType.PROXY, testurl))
prop.put("testlist_listedinproxy", "1");
if(Switchboard.urlBlacklist.isListed(BlacklistType.SEARCH, testurl))
prop.put("testlist_listedinsearch", "1");
if(Switchboard.urlBlacklist.isListed(BlacklistType.SURFTIPS, testurl))
prop.put("testlist_listedinsurftips", "1");
boolean isblocked = false;
if (Switchboard.urlBlacklist.isListed(BlacklistType.CRAWLER, testurl)) {
prop.put("testlist_listedincrawler", "1");
isblocked = true;
}
if (Switchboard.urlBlacklist.isListed(BlacklistType.DHT, testurl)) {
prop.put("testlist_listedindht", "1");
isblocked = true;
}
if (Switchboard.urlBlacklist.isListed(BlacklistType.NEWS, testurl)) {
prop.put("testlist_listedinnews", "1");
isblocked = true;
}
if (Switchboard.urlBlacklist.isListed(BlacklistType.PROXY, testurl)) {
prop.put("testlist_listedinproxy", "1");
isblocked = true;
}
if (Switchboard.urlBlacklist.isListed(BlacklistType.SEARCH, testurl)) {
prop.put("testlist_listedinsearch", "1");
isblocked = true;
}
if (Switchboard.urlBlacklist.isListed(BlacklistType.SURFTIPS, testurl)) {
prop.put("testlist_listedinsurftips", "1");
isblocked = true;
}
if (!isblocked) {
prop.put("testlist_isnotblocked", "1");
}
}
else {
prop.putHTML("url",urlstring);

@ -215,7 +215,7 @@ public class Blacklist {
loadedPathsPattern = new ArrayList<Pattern>();
for (String a: loadedPaths) {
if (a.equals("*")) {
loadedPathsPattern.add(Pattern.compile(".*"));
loadedPathsPattern.add(Pattern.compile("(?i).*"));
continue;
}
if (a.indexOf("?*",0) > 0) {
@ -223,7 +223,7 @@ public class Blacklist {
Log.logWarning("Blacklist", "ignored blacklist path to prevent 'Dangling meta character' exception: " + a);
continue;
}
loadedPathsPattern.add(Pattern.compile(a));
loadedPathsPattern.add(Pattern.compile("(?i)" + a)); // add case insesitive regex
}
// create new entry if host mask unknown, otherwise merge
@ -295,7 +295,7 @@ public class Blacklist {
blacklistMap.put(h, (hostList = new ArrayList<Pattern>()));
}
hostList.add(Pattern.compile(p));
hostList.add(Pattern.compile("(?i)" + p)); // add case insesitive regex
}
public int blacklistCacheSize() {

Loading…
Cancel
Save