Apache Nutch is an extensible and scalable web crawler
NUTCH-2581 Caching of redirected robots.txt may overwrite correct robots.txt rules - only cache redirected robots.txt rules if the target URL path and query equal /robots.txt
Sebastian Nagela6bef2218193
diff --git a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpRobotRulesParser.java b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpRobotRulesParser.javaindex 6e4627cff..6b9de0813 100644--- a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpRobotRulesParser.java+++ b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpRobotRulesParser.java@@ -174,8 +174,10 @@ public class HttpRobotRulesParser extends RobotRulesParser {if (cacheRule) {CACHE.put(cacheKey, robotRules); // cache rules for host- if (redir != null && !redir.getHost().equalsIgnoreCase(url.getHost())) {+ if (redir != null && !redir.getHost().equalsIgnoreCase(url.getHost())+ && "/robots.txt".equals(redir.getFile())) {// cache also for the redirected host+ // if the URL path is /robots.txtCACHE.put(getCacheKey(redir), robotRules);}}