Skip to content

Commit ceeac02

Browse files
Remove unreachable break after throw in TUNNEL_PROXY branch (#729)
1 parent 277adc3 commit ceeac02

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

  • httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic

httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ConnectExec.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,10 @@ public ClassicHttpResponse execute(
163163
break;
164164

165165
case HttpRouteDirector.TUNNEL_PROXY: {
166-
// The most simple example for this case is a proxy chain
167-
// of two proxies, where P1 must be tunnelled to P2.
168-
// route: Source -> P1 -> P2 -> Target (3 hops)
169-
// fact: Source -> P1 -> Target (2 hops)
170-
final int hop = fact.getHopCount() - 1; // the hop to establish
171-
final boolean secure = createTunnelToProxy(route, hop, context);
172-
if (LOG.isDebugEnabled()) {
173-
LOG.debug("{} tunnel to proxy created.", exchangeId);
174-
}
175-
tracker.tunnelProxy(route.getHopTarget(hop), secure);
166+
// Proxy chains are not supported by HttpClient.
167+
// Fail fast instead of attempting an untested tunnel to an intermediate proxy.
168+
throw new HttpException("Proxy chains are not supported.");
176169
}
177-
break;
178170

179171
case HttpRouteDirector.LAYER_PROTOCOL:
180172
execRuntime.upgradeTls(context);

0 commit comments

Comments
 (0)