Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-2549 protocol-http does not behave the same as browsers - be conformant with RFC 7230 and signal that connection is closed after response (patch contributed by Gerard Bouchar)

Sebastian Nagel2e485cfbdf46
diff --git a/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java b/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java
index b5b7dca65..4b5544e90 100644
--- a/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java
+++ b/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java
@@ -225,6 +225,10 @@ public class HttpResponse implements Response {
+ HttpDateFormat.toString(datum.getModifiedTime()));
reqStr.append("\r\n");
}
+
+ // "signal that this connection will be closed after completion of the
+ // response", see https://tools.ietf.org/html/rfc7230#section-6.1
+ reqStr.append("Connection: close\r\n");
reqStr.append("\r\n");
// store the request in the metadata?