Skip to content

Commit 2f6f0d0

Browse files
committed
Remove tunnel establishment checks. They are no longer needed as tunnelling is established when the connection is established.
1 parent 75de57a commit 2f6f0d0

File tree

4 files changed

+13
-49
lines changed

4 files changed

+13
-49
lines changed

providers/grizzly/src/main/java/org/asynchttpclient/providers/grizzly/EventHandler.java

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ public void onInitialLineParsed(HttpHeader httpHeader,
150150
final HttpTransactionContext context =
151151
HttpTransactionContext.get(connection);
152152
final int status = ((HttpResponsePacket) httpHeader).getStatus();
153-
if (context.isEstablishingTunnel() && HttpStatus.OK_200.statusMatches(status)) {
154-
return;
155-
}
156153
if (HttpStatus.CONINTUE_100.statusMatches(status)) {
157154
ctx.notifyUpstream(new ContinueEvent(context));
158155
return;
@@ -239,9 +236,7 @@ public void onHttpHeadersParsed(HttpHeader httpHeader,
239236
processKeepAlive(ctx.getConnection(), httpHeader);
240237
final HttpTransactionContext context = HttpTransactionContext.get(ctx.getConnection());
241238

242-
if (httpHeader.isSkipRemainder()
243-
|| (context.isEstablishingTunnel()
244-
&& context.getStatusHandler() == null)) {
239+
if (httpHeader.isSkipRemainder()) {
245240
return;
246241
}
247242

@@ -374,28 +369,18 @@ public boolean onHttpPacketParsed(HttpHeader httpHeader, FilterChainContext ctx)
374369

375370
final HttpResponsePacket response =
376371
(HttpResponsePacket) httpHeader;
377-
final HttpTransactionContext context = HttpTransactionContext.get(ctx.getConnection());
378-
if (context.isEstablishingTunnel()
379-
&& HttpStatus.OK_200.statusMatches(response.getStatus())) {
380-
context.setEstablishingTunnel(false);
381-
final Connection c = ctx.getConnection();
382-
context.tunnelEstablished(c);
383-
context.getProvider().execute(c,
384-
context.getRequest(),
385-
context.getHandler(),
386-
context.getFuture());
387-
} else {
388-
cleanup(ctx);
389-
final AsyncHandler handler = context.getHandler();
390-
if (handler != null) {
391-
try {
392-
context.result(handler.onCompleted());
393-
} catch (Exception e) {
394-
context.abort(e);
395-
}
396-
} else {
397-
context.done();
372+
final HttpTransactionContext context = HttpTransactionContext.get(
373+
ctx.getConnection());
374+
cleanup(ctx);
375+
final AsyncHandler handler = context.getHandler();
376+
if (handler != null) {
377+
try {
378+
context.result(handler.onCompleted());
379+
} catch (Exception e) {
380+
context.abort(e);
398381
}
382+
} else {
383+
context.done();
399384
}
400385
return false;
401386
}

providers/grizzly/src/main/java/org/asynchttpclient/providers/grizzly/HttpTransactionContext.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.asynchttpclient.providers.grizzly.bodyhandler.BodyHandler;
1919
import org.asynchttpclient.providers.grizzly.statushandler.StatusHandler;
2020
import org.asynchttpclient.websocket.WebSocket;
21-
import org.glassfish.grizzly.Connection;
2221
import org.glassfish.grizzly.Grizzly;
2322
import org.glassfish.grizzly.attributes.Attribute;
2423
import org.glassfish.grizzly.attributes.AttributeStorage;
@@ -58,7 +57,6 @@ public final class HttpTransactionContext {
5857
private HandShake handshake;
5958
private ProtocolHandler protocolHandler;
6059
private WebSocket webSocket;
61-
private boolean establishingTunnel;
6260

6361

6462
// -------------------------------------------------------- Constructors
@@ -255,15 +253,6 @@ public void setWebSocket(WebSocket webSocket) {
255253
this.webSocket = webSocket;
256254
}
257255

258-
public boolean isEstablishingTunnel() {
259-
return establishingTunnel;
260-
}
261-
262-
public void setEstablishingTunnel(boolean establishingTunnel) {
263-
this.establishingTunnel = establishingTunnel;
264-
}
265-
266-
267256
// ------------------------------------------------- Package Private Methods
268257

269258

@@ -297,13 +286,4 @@ void result(Object result) {
297286
}
298287
}
299288

300-
public boolean isTunnelEstablished(final Connection c) {
301-
return c.getAttributes().getAttribute("tunnel-established") != null;
302-
}
303-
304-
305-
public void tunnelEstablished(final Connection c) {
306-
c.getAttributes().setAttribute("tunnel-established", Boolean.TRUE);
307-
}
308-
309289
}

providers/grizzly/src/main/java/org/asynchttpclient/providers/grizzly/filters/AsyncHttpClientFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ private boolean sendAsGrizzlyRequest(final Request request,
254254
}
255255
}
256256

257-
if (httpCtx.isWSRequest() && !httpCtx.isEstablishingTunnel()) {
257+
if (httpCtx.isWSRequest()) {
258258
try {
259259
final URI wsURI = new URI(httpCtx.getWsRequestURI());
260260
httpCtx.setProtocolHandler(Version.RFC6455.createHandler(true));

providers/grizzly/src/main/java/org/asynchttpclient/providers/grizzly/statushandler/ProxyAuthorizationHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ public boolean handleStatus(final HttpResponsePacket responsePacket,
173173
HttpTransactionContext.set(c, newContext);
174174

175175
newContext.setInvocationStatus(tempInvocationStatus);
176-
httpTransactionContext.setEstablishingTunnel(true);
177176

178177
return executeRequest(httpTransactionContext, req, c);
179178

0 commit comments

Comments
 (0)