Skip to content

Commit aea3fa3

Browse files
committed
revert some changes
1 parent 8f872b6 commit aea3fa3

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncConnectExec.java

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ public final class AsyncConnectExec implements AsyncExecChainHandler {
102102
private final AuthCacheKeeper authCacheKeeper;
103103
private final HttpRouteDirector routeDirector;
104104

105-
// NEW: optional ALPN provider
106105
private final ConnectAlpnProvider alpnProvider;
107106

108107

@@ -292,7 +291,55 @@ public void cancelled() {
292291
if (LOG.isDebugEnabled()) {
293292
LOG.debug("{} create tunnel", exchangeId);
294293
}
295-
createTunnel(state, proxy, target, route, scope, asyncExecCallback); // pass route
294+
createTunnel(state, proxy, target, route, scope, new AsyncExecCallback() {
295+
296+
@Override
297+
public AsyncDataConsumer handleResponse(final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
298+
return asyncExecCallback.handleResponse(response, entityDetails);
299+
}
300+
301+
@Override
302+
public void handleInformationResponse(final HttpResponse response) throws HttpException, IOException {
303+
asyncExecCallback.handleInformationResponse(response);
304+
}
305+
306+
@Override
307+
public void completed() {
308+
if (!execRuntime.isEndpointConnected()) {
309+
// Remote endpoint disconnected. Need to start over
310+
if (LOG.isDebugEnabled()) {
311+
LOG.debug("{} proxy disconnected", exchangeId);
312+
}
313+
state.tracker.reset();
314+
}
315+
if (state.challenged) {
316+
if (LOG.isDebugEnabled()) {
317+
LOG.debug("{} proxy authentication required", exchangeId);
318+
}
319+
proceedToNextHop(state, request, entityProducer, scope, chain, asyncExecCallback);
320+
} else {
321+
if (state.tunnelRefused) {
322+
if (LOG.isDebugEnabled()) {
323+
LOG.debug("{} tunnel refused", exchangeId);
324+
}
325+
asyncExecCallback.completed();
326+
} else {
327+
if (LOG.isDebugEnabled()) {
328+
LOG.debug("{} tunnel to target created", exchangeId);
329+
}
330+
tracker.tunnelTarget(false);
331+
proceedToNextHop(state, request, entityProducer, scope, chain, asyncExecCallback);
332+
}
333+
}
334+
}
335+
336+
@Override
337+
public void failed(final Exception cause) {
338+
execRuntime.markConnectionNonReusable();
339+
asyncExecCallback.failed(cause);
340+
}
341+
342+
});
296343
break;
297344

298345
case HttpRouteDirector.TUNNEL_PROXY:

0 commit comments

Comments
 (0)