From 5164a4e7b4e122bd3f81db212f6d8ed4a681c583 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Thu, 19 Aug 2021 15:29:39 +0200 Subject: [PATCH] HTTPCLIENT-2170: Classic protocol layer no longer releases the underlying connection back to the pool prematurely while the NTLM handshake is still ongoing --- .../apache/hc/client5/http/impl/classic/MainClientExec.java | 3 --- .../org/apache/hc/client5/http/impl/classic/ProtocolExec.java | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MainClientExec.java index 7bf2ea75f..2af5b708e 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MainClientExec.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MainClientExec.java @@ -102,8 +102,6 @@ public ClassicHttpResponse execute( LOG.debug("{} executing {}", exchangeId, new RequestLine(request)); } try { - RequestEntityProxy.enhance(request); - final ClassicHttpResponse response = execRuntime.execute(exchangeId, request, context); Object userToken = context.getUserToken(); @@ -136,7 +134,6 @@ public ClassicHttpResponse execute( execRuntime.releaseEndpoint(); return new CloseableHttpResponse(response, null); } - ResponseEntityProxy.enhance(response, execRuntime); return new CloseableHttpResponse(response, execRuntime); } catch (final ConnectionShutdownException ex) { final InterruptedIOException ioex = new InterruptedIOException( diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java index 9b311cd81..2edfe4c2b 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java @@ -140,6 +140,7 @@ public ClassicHttpResponse execute( } } + RequestEntityProxy.enhance(request); for (;;) { @@ -207,6 +208,7 @@ public ClassicHttpResponse execute( request.addHeader(it.next()); } } else { + ResponseEntityProxy.enhance(response, execRuntime); return response; } }