hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cap zhou <zhouz...@gmail.com>
Subject How to close the underlying connection within callback?
Date Tue, 28 Jul 2015 12:45:46 GMT
Hi:

I want to close the underlying connection if the status code of response is
not 2XX, or I don't want the connection to be reused if any request on it
has ever failed. how? I am using httpasyncclient 4.0.2.

why I want to do this? Because in some situations my server may return
error right after it finished receiving the http headers while the body is
not completed. And the client may stop sending body if it receive the
response. And if the connection is reused by another request, the data of
http header of the new request may consider to be the rest body data of the
last request. Then the second request will fail with an unexpected
exception.

My solution to this problem is: don't reuse the connection if any request
has failed it.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message