Apache Nutch is an extensible and scalable web crawler
NUTCH-911 protocol-file to return proper protocol status for notmodified, gone, access_denied
Sebastian Nagel04228aeb3493
diff --git a/CHANGES.txt b/CHANGES.txtindex 7c16ff5b6..130a0d76c 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -2,6 +2,8 @@ Nutch Change LogNutch Development Trunk+* NUTCH-911 protocol-file to return proper protocol status (Peter Lundberg via snagel)+* NUTCH-806 Merge CrawlDBScanner with CrawlDBReader (jnioche)* NUTCH-1587 misspelled property "threshold" in conf/log4j.properties (snagel)diff --git a/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/File.java b/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/File.javaindex 22fb8c801..5a908b1dd 100644--- a/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/File.java+++ b/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/File.java@@ -105,6 +105,15 @@ public class File implements Protocol {if (code == 200) { // got a good responsereturn new ProtocolOutput(response.toContent()); // return it+ } else if (code == 304) { // got not modified+ return new ProtocolOutput(response.toContent(), ProtocolStatus.STATUS_NOTMODIFIED);++ } else if (code == 401) { // access denied / no read permissions+ return new ProtocolOutput(response.toContent(), new ProtocolStatus(ProtocolStatus.ACCESS_DENIED));++ } else if (code == 404) { // no such file+ return new ProtocolOutput(response.toContent(), ProtocolStatus.STATUS_NOTFOUND);+} else if (code >= 300 && code < 400) { // handle redirectif (redirects == MAX_REDIRECTS)throw new FileException("Too many redirects: " + url);