You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by Paul Tomblin <pt...@xcski.com> on 2009/08/10 22:58:46 UTC

Found a second problem in the same code

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