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] (HTTPCLIENT-1857) HttpClient falsely closes a reusable connection
Date Mon, 19 Jun 2017 07:33:00 GMT

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

Oleg Kalnichevski commented on HTTPCLIENT-1857:
-----------------------------------------------

bq. the content should actually be ignored but the connection should still be reusable

If the remaining content is simply ignored the next message request / response exchange will
not be properly delineated as the connection will still hold bits of the previous response
body.

Oleg

> HttpClient falsely closes a reusable connection
> -----------------------------------------------
>
>                 Key: HTTPCLIENT-1857
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1857
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>            Reporter: Rodolfo Udo Labsch
>         Attachments: ConnectionHolder.patch
>
>
> If you create a code with a reusable httpclient and then call execute as in the example
with the following code. The http connection will be falsely closed.
> {code:java}
> private PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
> httpClient = HttpClients.custom()
> .setConnectionManager(connectionManager)
> .build();
> try (CloseableHttpResponse response = httpClient.execute(new HttpGet(enetLink), context))
{
> .....
> }
> {code}
> The reason being that we have:
> {code:java}
> CloseableHttpResponse:
>     public void close() throws IOException {
>         if (this.connHolder != null) {
>             this.connHolder.close();
>         }
>     }
> ConnectionHolder:
>     public void close() throws IOException {
>         releaseConnection(false);
>     }
> {code}
> Just created the correction, which is attached as patch.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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


Mime
View raw message