Fix handling of server error on robots.txt - change to what appears to be the intended behavior

* DispositionProcessor.java
    innerProcess() - call server.updateRobots(curi) after special ignore-robots short-circuiting of retry cycle rather than before, so that updateRobots() deemed-not-found handling applies
* FetchHTTP.java
    call curi.setHttpMethod() right after creating the HttpMethod, instead of when processing the response; this is needed so that updateRobots() check of fetchType works properly (before this change, fetchType was "UNKNOWN" on server error)
* PreconditionEnforcer.java, CrawlServer.java
    fix typos
This commit is contained in:
nlevitt committed 2011-08-02 23:28:20 +00:00
1 parent 3cfc315de9
commit 706869e586
4 files changed
+10 -11

No files matched your search

@@ -189,12 +189,6 @@ public class DispositionProcessor extends Processor {
// Update robots info
try {
if ("/robots.txt".equals(curi.getUURI().getPath())) {
// Update server with robots info
// NOTE: in some cases the curi's status can be changed here
// server.updateRobots(metadata.getRobotsHonoringPolicy(), curi);
server.updateRobots(curi);
// shortcut retries w/ DEEMED when ignore-all
if (metadata.getRobotsPolicy() instanceof IgnoreRobotsPolicy) {
if(curi.getFetchStatus() < 0 && curi.getFetchStatus()!=S_DEFERRED) {
@@ -202,6 +196,10 @@ public class DispositionProcessor extends Processor {
curi.setFetchStatus(S_DEEMED_NOT_FOUND);
}
}
// Update server with robots info
// NOTE: in some cases the curi's status can be changed here
server.updateRobots(curi);
}
}
catch (URIException e) {
@@ -198,7 +198,7 @@ public class PreconditionEnforcer extends Processor {
* @param curi CrawlURI we're checking for any required preconditions.
* @return True, if this <code>curi</code> has a precondition or processing
* should be terminated for some other reason. False if
* we can precede to process this url.
* we can proceed to process this url.
*/
protected boolean considerRobotsPreconditions(CrawlURI curi) {
// treat /robots.txt fetches specially