You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2022/01/12 10:03:39 UTC
[httpcomponents-client] 01/01: HTTPCLIENT-2195, regression: classic ConnectExec incorrectly discards the proxy response body even if the request cannot be executed and the response is final
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch HTTPCLIENT-2195
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit 7ce11963849228b0c9e5f7d9f04aa11528a460c9
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Wed Jan 12 11:02:53 2022 +0100
HTTPCLIENT-2195, regression: classic ConnectExec incorrectly discards the proxy response body even if the request cannot be executed and the response is final
---
.../hc/client5/http/impl/classic/ConnectExec.java | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ConnectExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ConnectExec.java
index 357915f..842ba5a 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ConnectExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ConnectExec.java
@@ -227,23 +227,22 @@ public final class ConnectExec implements ExecChainHandler {
throw new HttpException("Unexpected response to CONNECT request: " + new StatusLine(response));
}
- if (this.reuseStrategy.keepAlive(connect, response, context)) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("{} connection kept alive", exchangeId);
- }
- // Consume response content
- final HttpEntity entity = response.getEntity();
- EntityUtils.consume(entity);
- } else {
- execRuntime.disconnectEndpoint();
- }
-
if (config.isAuthenticationEnabled()) {
if (this.authenticator.isChallenged(proxy, ChallengeType.PROXY, response,
proxyAuthExchange, context)) {
if (this.authenticator.updateAuthState(proxy, ChallengeType.PROXY, response,
this.proxyAuthStrategy, proxyAuthExchange, context)) {
// Retry request
+ if (this.reuseStrategy.keepAlive(connect, response, context)) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("{} connection kept alive", exchangeId);
+ }
+ // Consume response content
+ final HttpEntity entity = response.getEntity();
+ EntityUtils.consume(entity);
+ } else {
+ execRuntime.disconnectEndpoint();
+ }
response = null;
}
}