HttpClient.execute should close connection rather than call consumeContent
--------------------------------------------------------------------------

                 Key: HTTPCLIENT-1083
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1083
             Project: HttpComponents HttpClient
          Issue Type: Improvement
    Affects Versions: 4.1.1
            Reporter: Stepan Koltsov


HttpClient.execute(..., responseHandler) calls consumeContent on error.

This is inappropriate. If we are processing 1Gb files and responseHandler fails 
(throws an exception) somewhere at the beginning of the file, HttpClient calls 
consumeContent, and we have to wait until this 1Gb file transferred over the 
network. Even worse, if server is stuck, and callback thrown exception (or 
quietly returned after examining first 10 bytes of response), we have to wait 
for read timeout.

I think connection should be just closed on error (only if the end of the 
response stream is not yet reached).

Moreover I think that connection should be also closed if responseHandler 
completed successfully (and response is not fully read).

And anyway, reopening a connection must be no more expensive than downloading 
the rest of the response message.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to