Skip to content

Commit

Permalink
set revisit profile on 304 not modified
Browse files Browse the repository at this point in the history
  • Loading branch information
nlevitt committed Jul 11, 2014
1 parent 905a98c commit 810ad91
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.archive.modules.CrawlURI;
import org.archive.modules.Processor;
import org.archive.modules.revisit.IdenticalPayloadDigestRevisit;
import org.archive.modules.revisit.ServerNotModifiedRevisit;

/**
* Maintain a history of fetch information inside the CrawlURI's attributes.
Expand Down Expand Up @@ -105,7 +106,12 @@ protected void innerProcess(CrawlURI puri) throws InterruptedException {

curi.getData().put(A_FETCH_HISTORY, history);

if (hasIdenticalDigest(curi)) {
if (curi.getFetchStatus() == 304) {
ServerNotModifiedRevisit revisit = new ServerNotModifiedRevisit();
revisit.setETag((String) latestFetch.get(A_ETAG_HEADER));
revisit.setLastModified((String) latestFetch.get(A_LAST_MODIFIED_HEADER));
curi.setRevisitProfile(revisit);
} else if (hasIdenticalDigest(curi)) {
curi.getAnnotations().add("duplicate:digest");
IdenticalPayloadDigestRevisit revisit =
new IdenticalPayloadDigestRevisit((String)history[1].get(A_CONTENT_DIGEST));
Expand Down

0 comments on commit 810ad91

Please sign in to comment.