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:38 UTC

[httpcomponents-client] branch HTTPCLIENT-2195 created (now 7ce1196)

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a change to branch HTTPCLIENT-2195
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git.


      at 7ce1196  HTTPCLIENT-2195, regression: classic ConnectExec incorrectly discards the proxy response body even if the request cannot be executed and the response is final

This branch includes the following new commits:

     new 7ce1196  HTTPCLIENT-2195, regression: classic ConnectExec incorrectly discards the proxy response body even if the request cannot be executed and the response is final

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[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

Posted by ol...@apache.org.
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;
                     }
                 }