[ 
https://issues.apache.org/jira/browse/NUTCH-1112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13104294#comment-13104294
 ] 

Edward Drapkin commented on NUTCH-1112:
---------------------------------------

This looks also like it will truncate content on other pages up to the length 
of the buffer.  The last iteration through that loop will make the condition 
`totalRead + bufferFilled == contentLength` true, so that last buffer will get 
tossed aside.

> protocol-httpclient doesn't accept content when all of it fits in the buffer 
> at once
> ------------------------------------------------------------------------------------
>
>                 Key: NUTCH-1112
>                 URL: https://issues.apache.org/jira/browse/NUTCH-1112
>             Project: Nutch
>          Issue Type: Bug
>          Components: fetcher
>    Affects Versions: 1.3
>            Reporter: Edward Drapkin
>
> This line of code is in 
> protocol-httpclient/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpResponse.java:
> while ((bufferFilled = in.read(buffer, 0, buffer.length)) != -1 && totalRead 
> + bufferFilled < contentLength) {
>    ...
> } 
> When the entire content length is less than the size of the buffer, the 
> entire content will be read into the buffer (and bufferFilled == 
> contentLength) and the HttpResponse object here will have empty content.  
> This simply needs to be changed to `totalRead + bufferFilled <= 
> contentLength`.
> Thanks!

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to