Skip to content

Commit 2f6549d

Browse files
committed
Better handling of an Abort state when dealing with a WS request.
1 parent 3472bc2 commit 2f6549d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

providers/grizzly/src/main/java/com/ning/http/client/providers/grizzly/GrizzlyAsyncHttpProvider.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
import org.glassfish.grizzly.websockets.DataFrame;
102102
import org.glassfish.grizzly.websockets.DefaultWebSocket;
103103
import org.glassfish.grizzly.websockets.HandShake;
104+
import org.glassfish.grizzly.websockets.HandshakeException;
104105
import org.glassfish.grizzly.websockets.ProtocolHandler;
105106
import org.glassfish.grizzly.websockets.Version;
106107
import org.glassfish.grizzly.websockets.WebSocketEngine;
@@ -1209,6 +1210,10 @@ protected void onInitialLineParsed(HttpHeader httpHeader,
12091210
final AsyncHandler handler = context.handler;
12101211
if (handler != null) {
12111212
context.currentState = handler.onStatusReceived(responseStatus);
1213+
if (context.isWSRequest && context.currentState == AsyncHandler.STATE.ABORT) {
1214+
httpHeader.setSkipRemainder(true);
1215+
context.abort(new HandshakeException("Upgrade failed"));
1216+
}
12121217
}
12131218
} catch (Exception e) {
12141219
httpHeader.setSkipRemainder(true);

0 commit comments

Comments
 (0)