Re: How to reuse TCP connection when using a proxy with java.net.http.HttpClient in HTTP/1.1

2021-01-12 Thread Daniel Fuchs
On 11/01/2021 22:51, Simone Bordet wrote: The problem is on the client: if the client application does not read the response content, the client implementation cannot reuse that connection. It cannot use it to send the next request (independently from the server reading it or not), because when t

Re: How to reuse TCP connection when using a proxy with java.net.http.HttpClient in HTTP/1.1

2021-01-11 Thread Bernd Eckenfels
Von: net-dev im Auftrag von Simone Bordet Gesendet: Monday, January 11, 2021 10:51:16 PM An: Nicolas Henneaux Cc: Daniel Fuchs ; OpenJDK Network Dev list Betreff: Re: How to reuse TCP connection when using a proxy with java.net.http.HttpClient in HTTP/1.1 Hi, On Mon, Jan 11

Re: How to reuse TCP connection when using a proxy with java.net.http.HttpClient in HTTP/1.1

2021-01-11 Thread Simone Bordet
Hi, On Mon, Jan 11, 2021 at 10:13 PM Nicolas Henneaux wrote: > > Thanks Simone, that makes sense. I haven't thought there is actually no other > way for the server to know the response is fully consumed or not. Just to be clear, it's not a server problem. The server won't read the next request

Re: How to reuse TCP connection when using a proxy with java.net.http.HttpClient in HTTP/1.1

2021-01-11 Thread Nicolas Henneaux
Thanks Simone, that makes sense. I haven't thought there is actually no other way for the server to know the response is fully consumed or not. Thanks all! Nicolas On Mon, 11 Jan 2021 at 22:08, Simone Bordet wrote: > Hi, > > On Mon, Jan 11, 2021 at 9:28 PM Nicolas Henneaux > wrote: > > > > Hi

Re: How to reuse TCP connection when using a proxy with java.net.http.HttpClient in HTTP/1.1

2021-01-11 Thread Simone Bordet
Hi, On Mon, Jan 11, 2021 at 9:28 PM Nicolas Henneaux 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

Re: How to reuse TCP connection when using a proxy with java.net.http.HttpClient in HTTP/1.1

2021-01-11 Thread Nicolas Henneaux
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? Best regards, Nicolas On Mon, 11 Jan 2021 at 21:00, Daniel Fuchs wrote: > Hi Nicolas, > > If I understand correctly you are closing the input stream wi

Re: How to reuse TCP connection when using a proxy with java.net.http.HttpClient in HTTP/1.1

2021-01-11 Thread Daniel Fuchs
Hi Nicolas, If I understand correctly you are closing the input stream without draining the bytes. With HTTP/1.1 this will force the connection to get closed. This is the expected behavior. best regards, -- daniel On 11/01/2021 20:29, Nicolas Henneaux wrote: Hi, I have a problem when using J

How to reuse TCP connection when using a proxy with java.net.http.HttpClient in HTTP/1.1

2021-01-11 Thread Nicolas Henneaux
Hi, I have a problem when using Java HttpClient with a proxy and HTTP/1.1 version. When using a stream body handler, there is no re-use of the TCP connection. When using another body handler (java.net.http.HttpResponse.BodyHandlers#ofString() or java.net.http.HttpResponse.BodyHandlers#discarding)