Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-2556 protocol-http makes invalid HTTP/1.0 requests - use HTTP/1.1 by default (setting http.useHttp11 = false will sent HTTP/1.0 requests)

Sebastian Nagel73d082e3e3f3
diff --git a/conf/nutch-default.xml b/conf/nutch-default.xml
index fcedc6df0..cb2d2df50 100644
--- a/conf/nutch-default.xml
+++ b/conf/nutch-default.xml
@@ -310,9 +310,9 @@
<property>
<name>http.useHttp11</name>
- <value>false</value>
- <description>NOTE: at the moment this works only for protocol-httpclient.
- If true, use HTTP 1.1, if false use HTTP 1.0 .
+ <value>true</value>
+ <description>
+ If true, use HTTP 1.1, if false use HTTP 1.0 .
</description>
</property>
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 a4b6275b1..a5594a3e8 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
@@ -166,7 +166,11 @@ public class HttpResponse implements Response {
reqStr.append(path);
}
- reqStr.append(" HTTP/1.0\r\n");
+ if (http.getUseHttp11()) {
+ reqStr.append(" HTTP/1.1\r\n");
+ } else {
+ reqStr.append(" HTTP/1.0\r\n");
+ }
reqStr.append("Host: ");
reqStr.append(host);