From 9cca70291e6548c355d60c28441f8e6e19cc5507 Mon Sep 17 00:00:00 2001 From: Arturo Bernal Date: Thu, 2 Oct 2025 19:28:56 +0200 Subject: [PATCH] Remove unreachable break after throw in TUNNEL_PROXY branch --- .../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 d3383523cb..fc0f8d5106 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);