Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-2124 Fetcher following same redirect again and again

Sebastian Nagel908378bd140f
diff --git a/CHANGES.txt b/CHANGES.txt
index 95248d7b3..a4e648973 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,8 @@ Nutch Change Log
Nutch Current Development 1.11-SNAPSHOT
+* NUTCH-2124 Fetcher following same redirect again and again (Yogendra Kumar Soni via snagel)
+
* NUTCH-2123 Seed List REST API returns Text but headers indicate/require JSON
(Aron Ahmadia, Sujen Shah via mattmann)
diff --git a/src/java/org/apache/nutch/fetcher/FetcherThread.java b/src/java/org/apache/nutch/fetcher/FetcherThread.java
index 9a482b93d..85d061178 100644
--- a/src/java/org/apache/nutch/fetcher/FetcherThread.java
+++ b/src/java/org/apache/nutch/fetcher/FetcherThread.java
@@ -325,7 +325,7 @@ public class FetcherThread extends Thread {
newUrl, refreshTime < Fetcher.PERM_REFRESH_TIME,
Fetcher.CONTENT_REDIR);
if (redirUrl != null) {
- queueRedirect(redirUrl, fit);
+ fit = queueRedirect(redirUrl, fit);
}
}
break;
@@ -346,7 +346,7 @@ public class FetcherThread extends Thread {
Text redirUrl = handleRedirect(fit.url, fit.datum, urlString,
newUrl, temp, Fetcher.PROTOCOL_REDIR);
if (redirUrl != null) {
- queueRedirect(redirUrl, fit);
+ fit = queueRedirect(redirUrl, fit);
} else {
// stop redirecting
redirecting = false;
@@ -485,7 +485,7 @@ public class FetcherThread extends Thread {
}
}
- private void queueRedirect(Text redirUrl, FetchItem fit)
+ private FetchItem queueRedirect(Text redirUrl, FetchItem fit)
throws ScoringFilterException {
CrawlDatum newDatum = new CrawlDatum(CrawlDatum.STATUS_DB_UNFETCHED,
fit.datum.getFetchInterval(), fit.datum.getScore());
@@ -506,6 +506,7 @@ public class FetcherThread extends Thread {
reporter.incrCounter("FetcherStatus", "FetchItem.notCreated.redirect",
1);
}
+ return fit;
}
private void logError(Text url, String message) {