You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by jn...@apache.org on 2015/01/16 12:30:55 UTC
svn commit: r1652391 - in /nutch/trunk: CHANGES.txt
src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java
Author: jnioche
Date: Fri Jan 16 11:30:54 2015
New Revision: 1652391
URL: http://svn.apache.org/r1652391
Log:
(NUTCH-1919) Getting timeout when server returns Content-Length: 0
Modified:
nutch/trunk/CHANGES.txt
nutch/trunk/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java
Modified: nutch/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/nutch/trunk/CHANGES.txt?rev=1652391&r1=1652390&r2=1652391&view=diff
==============================================================================
--- nutch/trunk/CHANGES.txt (original)
+++ nutch/trunk/CHANGES.txt Fri Jan 16 11:30:54 2015
@@ -2,6 +2,8 @@ Nutch Change Log
Nutch Current Development 1.10-SNAPSHOT
+* NUTCH-1919 Getting timeout when server returns Content-Length: 0 (jnioche)
+
* NUTCH-1912 Dump tool -mimetype parameter needs to be optional to prevent NPE (Tyler Palsulich via lewismc)
* NUTCH-1881 ant target resolve-default to keep test libs (snagel)
Modified: nutch/trunk/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java
URL: http://svn.apache.org/viewvc/nutch/trunk/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java?rev=1652391&r1=1652390&r2=1652391&view=diff
==============================================================================
--- nutch/trunk/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java (original)
+++ nutch/trunk/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java Fri Jan 16 11:30:54 2015
@@ -288,6 +288,13 @@ public class HttpResponse implements Res
ByteArrayOutputStream out = new ByteArrayOutputStream(Http.BUFFER_SIZE);
byte[] bytes = new byte[Http.BUFFER_SIZE];
int length = 0;
+
+ // do not try to read if the contentLength is 0
+ if (contentLength == 0){
+ content = new byte[0];
+ return;
+ }
+
// read content
int i = in.read(bytes);
while (i != -1) {