You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2016/06/08 10:44:21 UTC

[jira] [Commented] (HTTPCORE-422) HttpAsyncRequestExecutor#responseReceived calls HttpAsyncResponseConsumer#responseReceived(HttpResponse), even for HEAD requests

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

Oleg Kalnichevski commented on HTTPCORE-422:
--------------------------------------------

Tom
I am not sure I fully understand the issue. The contract of {{HttpAsyncResponseConsumer}} interface is described [here|http://hc.apache.org/httpcomponents-core-4.4.x/tutorial/html/nio.html#d5e1173]. The {{#responseReceived}} method should be called for all types of messages when the message head is received. The {{#consumeContent}} method should be called for messages with an enclosed entity. 

Why would not one want to have {{#responseReceived}} method called for a response to HEAD request? This would effectively prevent the caller from getting hold of response status code and response headers.

Am I missing something?

Oleg



> HttpAsyncRequestExecutor#responseReceived calls HttpAsyncResponseConsumer#responseReceived(HttpResponse), even for HEAD requests
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-422
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-422
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore NIO
>    Affects Versions: 4.4.4
>            Reporter: Tom Fitzhenry
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>
> HttpAsyncRequestExecutor#responseReceived(NHttpClientConnection) calls HttpAsyncResponseConsumer#responseReceived(HttpResponse) via HttpAsyncClientExchangeHandler#responseReceived(HttpResponse).
> See https://github.com/apache/httpcore/blob/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java#L302 .
> It does this even if the request is a HEAD request. If your HttpAsyncResponseConsumer is a BasicAsyncResponseConsumer, then this will allocate a buffer of size content-length kB (or 4kB, if content-length does not exist).
> For a simple proxying Java app, profiling revealed this the allocation due to this was a bottleneck.
> It'd be nice if 
> Are there use cases for calling HttpAsyncResponseConsumer#responseReceived(HttpResponse) on HEAD requests? If not, perhaps it could not be called.
> FWIW, it looks like httpclient doe not call the corresponding method for HEAD requests: https://github.com/apache/httpcore/blob/4.4.x/httpcore/src/main/java/org/apache/http/protocol/HttpRequestExecutor.java#L273-L275



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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