Fix a bug where first websocket frame is discarded (#332)
This commit is contained in:
parent
e2a7462d70
commit
743596aaea
@ -152,7 +152,7 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker {
|
||||
request.addHeader(Names.ORIGIN, originValue);
|
||||
request.addHeader(Names.SEC_WEBSOCKET_KEY1, key1);
|
||||
request.addHeader(Names.SEC_WEBSOCKET_KEY2, key2);
|
||||
String expectedSubprotocol = this.getExpectedSubprotocol();
|
||||
String expectedSubprotocol = getExpectedSubprotocol();
|
||||
if (expectedSubprotocol != null && !expectedSubprotocol.equals("")) {
|
||||
request.addHeader(Names.SEC_WEBSOCKET_PROTOCOL, expectedSubprotocol);
|
||||
}
|
||||
@ -223,9 +223,8 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker {
|
||||
String subprotocol = response.getHeader(Names.SEC_WEBSOCKET_PROTOCOL);
|
||||
setActualSubprotocol(subprotocol);
|
||||
|
||||
channel.pipeline().replace(
|
||||
HttpResponseDecoder.class, "ws-decoder",
|
||||
new WebSocket00FrameDecoder(getMaxFramePayloadLength()));
|
||||
channel.pipeline().get(HttpResponseDecoder.class).replace(
|
||||
"ws-decoder", new WebSocket00FrameDecoder(getMaxFramePayloadLength()));
|
||||
|
||||
setHandshakeComplete();
|
||||
}
|
||||
|
@ -200,7 +200,8 @@ public class WebSocketClientHandshaker08 extends WebSocketClientHandshaker {
|
||||
String subprotocol = response.getHeader(Names.SEC_WEBSOCKET_PROTOCOL);
|
||||
setActualSubprotocol(subprotocol);
|
||||
|
||||
channel.pipeline().replace(HttpResponseDecoder.class, "ws-decoder",
|
||||
channel.pipeline().get(HttpResponseDecoder.class).replace(
|
||||
"ws-decoder",
|
||||
new WebSocket08FrameDecoder(false, allowExtensions, getMaxFramePayloadLength()));
|
||||
|
||||
setHandshakeComplete();
|
||||
|
@ -200,7 +200,8 @@ public class WebSocketClientHandshaker13 extends WebSocketClientHandshaker {
|
||||
String subprotocol = response.getHeader(Names.SEC_WEBSOCKET_PROTOCOL);
|
||||
setActualSubprotocol(subprotocol);
|
||||
|
||||
channel.pipeline().replace(HttpResponseDecoder.class, "ws-decoder",
|
||||
channel.pipeline().get(HttpResponseDecoder.class).replace(
|
||||
"ws-decoder",
|
||||
new WebSocket13FrameDecoder(false, allowExtensions, getMaxFramePayloadLength()));
|
||||
|
||||
setHandshakeComplete();
|
||||
|
Loading…
Reference in New Issue
Block a user