[
https://issues.apache.org/jira/browse/HTTPCORE-559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16645807#comment-16645807
]
ASF GitHub Bot commented on HTTPCORE-559:
-----------------------------------------
GitHub user dmap opened a pull request:
https://github.com/apache/httpcomponents-core/pull/89
Allow default http client connection to read simple streamed responses
As per spec these responses are terminated by the end of stream.
Issue: https://issues.apache.org/jira/browse/HTTPCORE-559
Note: this PR breaks one existing unit test - namely
{{testReadResponseNoEntity}} from {{TestDefaultBHttpClientConnection}}. The
test is trivial to fix, but I'm not sure what you want the desired behaviour to
be when an 'empty' response is returned. Previously the result was a null
entity, but with my change the result is now an empty entity, an entity with no
content. I think this is fine, but you may not.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/dmap/httpcomponents-core bugfix/HTTPCORE-559
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/httpcomponents-core/pull/89.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #89
----
commit 9a286c925288e4488ac3edd084c662143738ec2f
Author: David Maplesden <david@...>
Date: 2018-10-11T01:11:39Z
Allow default http client connection to read simple streamed responses
As per spec these responses are terminated by the end of stream.
Issue: HTTPCORE-559
----
> The DefaultBHttpClientConnection will not read a simple end-of-stream
> terminated HTTP response body
> ---------------------------------------------------------------------------------------------------
>
> Key: HTTPCORE-559
> URL: https://issues.apache.org/jira/browse/HTTPCORE-559
> Project: HttpComponents HttpCore
> Issue Type: Bug
> Components: HttpCore
> Affects Versions: 5.0-beta3
> Reporter: David Maplesden
> Priority: Major
>
> When you use the Classic HttpClient to execute a GET request for a resource
> which is returned with no Content-Length or Transfer-Encoding header then the
> response body (which should be now terminated by the closing of the stream)
> is not read. Instead the client returns an empty response with no attempt
> made to read from the stream.
> I realize that virtually no responses are ever sent this way, they almost
> always either have a content length or use chunked transfer encoding, but it
> is still legal as per the HTTP spec to return a response without using either
> of these and relying on the end-of-stream to terminate the response body.
> Currently if a server is doing this, the HttpClient won't receive the
> response.
> I found this problem testing the HttpClient, but I believe the root source of
> the problem is in the DefaultBHttpClientConnection implementation.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]