Github user jorgelbg commented on a diff in the pull request:

    https://github.com/apache/nutch/pull/55#discussion_r39866086
  
    --- Diff: 
src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java
 ---
    @@ -193,34 +197,54 @@ public HttpResponse(HttpBase http, URL url, 
CrawlDatum datum)
           reqStr.append("\r\n");
     
           if (http.isIfModifiedSinceEnabled() && datum.getModifiedTime() > 0) {
    -        reqStr.append("If-Modified-Since: "
    -            + HttpDateFormat.toString(datum.getModifiedTime()));
    +        reqStr.append("If-Modified-Since: " + HttpDateFormat
    +            .toString(datum.getModifiedTime()));
             reqStr.append("\r\n");
           }
           reqStr.append("\r\n");
     
    +      // store the request in the metadata?
    +      if (conf.getBoolean("store.http.request", false) == true) {
    +        headers.add("_request_", reqStr.toString());
    +      }
    +
           byte[] reqBytes = reqStr.toString().getBytes();
     
           req.write(reqBytes);
           req.flush();
     
           PushbackInputStream in = // process response
    -      new PushbackInputStream(new 
BufferedInputStream(socket.getInputStream(),
    -          Http.BUFFER_SIZE), Http.BUFFER_SIZE);
    +          new PushbackInputStream(
    +              new BufferedInputStream(socket.getInputStream(),
    +                  Http.BUFFER_SIZE), Http.BUFFER_SIZE);
     
           StringBuffer line = new StringBuffer();
     
    +      // store the http headers verbatim
    +      if (conf.getBoolean("store.http.headers", false) == true) {
    +        httpHeaders = new StringBuffer();
    +      }
    +
    +      headers.add("nutch.fetch.time", Long.toString(datum.getFetchTime()));
    --- End diff --
    
    I understand, fixed/pushed then!, the misleading portion of the comment for 
me was that it should hold the right value unless the `CrawlDbReducer` gets 
called. The `fetchTime` parameter gets initialized to the 
`System.currentTimeMillis()` upon creation. But this way we have 0 doubts about 
the value. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to