mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-09-22 21:55:54 +00:00
Make Content-Location header url INFERRED not REFFER hop type since Content-Location is not for redirection (#151)
This commit is contained in:
@@ -62,8 +62,7 @@ public class ExtractorHTTP extends Extractor {
|
||||
protected void extract(CrawlURI curi) {
|
||||
// discover headers if present
|
||||
addHeaderLink(curi, "Location");
|
||||
addHeaderLink(curi, "Content-Location");
|
||||
|
||||
addContentLocationHeaderLink(curi, "Content-Location");
|
||||
addRefreshHeaderLink(curi, "Refresh");
|
||||
|
||||
// try /favicon.ico for every HTTP(S) URI
|
||||
@@ -92,6 +91,19 @@ public class ExtractorHTTP extends Extractor {
|
||||
}
|
||||
}
|
||||
|
||||
protected void addContentLocationHeaderLink(CrawlURI curi, String headerKey) {
|
||||
String headerValue = curi.getHttpResponseHeader(headerKey);
|
||||
if (headerValue != null) {
|
||||
try {
|
||||
UURI dest = UURIFactory.getInstance(curi.getUURI(), headerValue);
|
||||
addOutlink(curi, dest.toString(), LinkContext.INFERRED_MISC, Hop.INFERRED);
|
||||
numberOfLinksExtracted.incrementAndGet();
|
||||
} catch (URIException e) {
|
||||
logUriError(e, curi.getUURI(), headerValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void addHeaderLink(CrawlURI curi, String headerName, String url) {
|
||||
try {
|
||||
UURI dest = UURIFactory.getInstance(curi.getUURI(), url);
|
||||
|
||||
Reference in New Issue
Block a user