How to reuse TCP connection when using a proxy with java.net.http.HttpClient in HTTP/1.1
Simone Bordet
simone.bordet at gmail.com
Mon Jan 11 21:08:03 UTC 2021
Hi,
On Mon, Jan 11, 2021 at 9:28 PM Nicolas Henneaux
<nicolas.henneaux at gmail.com> wrote:
>
> Hi Daniel,
>
> Thanks for your quick feedback.
>
> Indeed if I fetch all the bytes, the connection is kept. What's the reason behind this behaviour?
It's normal behavior.
The server may have not finished to send all the bytes in case of
large response contents.
If the client reuses the connection to send another request, when it
tries to read the response it will find bytes of the previous
response.
There is no other way than closing the connection to ensure that the
next request is not messed up.
In case you wonder, there are so many other ways to screw things up
that really, there is no other way than closing the connection :)
--
Simone Bordet
---
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless. Victoria Livschitz
More information about the net-dev
mailing list