hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCORE-422) HttpAsyncRequestExecutor#responseReceived calls HttpAsyncResponseConsumer#responseReceived(HttpResponse), even for HEAD requests
Date Wed, 15 Jun 2016 15:21:09 GMT

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

Oleg Kalnichevski commented on HTTPCORE-422:

bq. The problem is that BasicAsyncResponseConsumer#responseReceived allocates a 4kB buffer
for the response entity, even if the request is a HEAD request (and hence will have no response

Tom, are you sure about it? {{BasicAsyncResponseConsumer}} should allocate a buffer in response
to {{#onEntityEnclosed}} event, which should never get triggered for HEAD requests.


> 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:

This message was sent by Atlassian JIRA

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

View raw message