Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) Better handling of robots.txt files with incorrect keywords See: http://www.yacy-forum.de/viewtopic.php?p=12292#12292
thelif9fb284fb76e
diff --git a/source/de/anomic/data/robotsParser.java b/source/de/anomic/data/robotsParser.javaindex 17b9c93c1..42e6be1b2 100644--- a/source/de/anomic/data/robotsParser.java+++ b/source/de/anomic/data/robotsParser.java@@ -98,16 +98,17 @@ public final class robotsParser{ArrayList deny = new ArrayList();int pos;- String line = null;- boolean rule4Yacy = false;+ String line = null, lineUpper = null;+ boolean rule4Yacy = false;while ((line = reader.readLine()) != null) {line = line.trim();+ lineUpper = line.toUpperCase();if (line.length() == 0) {// we have reached the end of the rule blockrule4Yacy = false;} else if (line.startsWith("#")) {// we can ignore this. Just a comment line- } else if ((!rule4Yacy) && (line.startsWith("User-agent:"))) {+ } else if ((!rule4Yacy) && (lineUpper.startsWith("User-agent:".toUpperCase()))) {// cutting off comments at the line endpos = line.indexOf("#");if (pos != -1) {@@ -120,7 +121,13 @@ public final class robotsParser{String userAgent = line.substring(pos).trim();rule4Yacy = (userAgent.equals("*") || (userAgent.toLowerCase().indexOf("yacy") >=0));}- } else if (line.startsWith("Disallow:") && rule4Yacy) {+ } else if (lineUpper.startsWith("Disallow:".toUpperCase()) && rule4Yacy) {+ // cutting off comments at the line end+ pos = line.indexOf("#");+ if (pos != -1) {+ line = line.substring(0,pos);+ }+pos = line.indexOf(" ");if (pos != -1) {// getting the path