hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran (JIRA)" <j...@apache.org>
Subject [jira] Created: (HTTPCORE-235) EntityUtils.toString() doesn't detect/report less content being returned than was promised
Date Thu, 16 Sep 2010 10:30:37 GMT
EntityUtils.toString() doesn't detect/report less content being returned than was promised
------------------------------------------------------------------------------------------

                 Key: HTTPCORE-235
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-235
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore
    Affects Versions: 4.0.1
            Reporter: Steve Loughran


Also on my review of EntityUtils.toString(), I see that it's code to take an input stream
and a content length only uses the content length parameter to set the size of the buffer
-there is no attempt to verify that the amount of data received was as expected and raise
an {{IOException}} if less data arrived. 

While this code will appear to work, especially on loopback and local connections, it is flawed
long-haul where connections are often dropped early. 

I propose streaming the entity content to a byte array, validating the length, then building
a string in the appropriate charset from the buffer if it is valid.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message