You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ab...@apache.org on 2025/10/05 13:26:33 UTC

(httpcomponents-client) branch master updated: Remove unreachable break after throw in TUNNEL_PROXY branch (#729)

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

abernal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git


The following commit(s) were added to refs/heads/master by this push:
     new ceeac021c Remove unreachable break after throw in TUNNEL_PROXY branch (#729)
ceeac021c is described below

commit ceeac021cf5ab9735d7c44ff91ed2856b5f60a0b
Author: Arturo Bernal <ab...@apache.org>
AuthorDate: Sun Oct 5 15:26:27 2025 +0200

    Remove unreachable break after throw in TUNNEL_PROXY branch (#729)
---
 .../apache/hc/client5/http/impl/classic/ConnectExec.java   | 14 +++-----------
 1 file changed, 3 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 d3383523c..fc0f8d510 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
@@ -163,18 +163,10 @@ public ClassicHttpResponse execute(
                         break;
 
                         case HttpRouteDirector.TUNNEL_PROXY: {
-                            // The most simple example for this case is a proxy chain
-                            // of two proxies, where P1 must be tunnelled to P2.
-                            // route: Source -> P1 -> P2 -> Target (3 hops)
-                            // fact:  Source -> P1 -> Target       (2 hops)
-                            final int hop = fact.getHopCount() - 1; // the hop to establish
-                            final boolean secure = createTunnelToProxy(route, hop, context);
-                            if (LOG.isDebugEnabled()) {
-                                LOG.debug("{} tunnel to proxy created.", exchangeId);
-                            }
-                            tracker.tunnelProxy(route.getHopTarget(hop), secure);
+                            // Proxy chains are not supported by HttpClient.
+                            // Fail fast instead of attempting an untested tunnel to an intermediate proxy.
+                            throw new HttpException("Proxy chains are not supported.");
                         }
-                        break;
 
                         case HttpRouteDirector.LAYER_PROTOCOL:
                             execRuntime.upgradeTls(context);