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

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

Could you please try out this patch and let me know if that resolves the issue 
for you?

https://github.com/ok2c/httpcore/commit/f1135662c5b9d4e8d7a9b4ccd3228139163eca57

Oleg

> BasicAsyncResponseConsumer#onEntityEnclosed is triggered for HEAD responses
> ---------------------------------------------------------------------------
>
>                 Key: HTTPCORE-422
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-422
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.4.5
>            Reporter: Tom Fitzhenry
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>             Fix For: 4.4.6
>
>
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to