nutch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Tomblin <ptomb...@xcski.com>
Subject Found a second problem in the same code
Date Mon, 10 Aug 2009 20:58:46 GMT
The other reason that the If-Modified-Since doesn't work is that there is a
  reqStr.append("\r\n");
before the code I mentioned before, not after it.  That puts in a
blank line, and Apache takes a blank line as an "end of the headers"
mark, so it ignores the If-Modified-Since.  Here's my diff against the
trunk:

Index: src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java
===================================================================
--- src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java	(revision
802632)
+++ src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java	(working
copy)
@@ -124,11 +124,15 @@
         reqStr.append("\r\n");
       }

-      reqStr.append("\r\n");
       if (datum.getModifiedTime() > 0) {
         reqStr.append("If-Modified-Since: " +
HttpDateFormat.toString(datum.getModifiedTime()));
         reqStr.append("\r\n");
       }
+      else if (datum.getFetchTime() > 0) {
+          reqStr.append("If-Modified-Since: " +
HttpDateFormat.toString(datum.getFetchTime()));
+          reqStr.append("\r\n");
+      }
+      reqStr.append("\r\n");

       byte[] reqBytes= reqStr.toString().getBytes();



-- 
http://www.linkedin.com/in/paultomblin

Mime
View raw message