Skip to content

Commit d8b32a4

Browse files
Norman Maurerjfarcand
Norman Maurer
authored andcommitted
Make sure no bytes are lost when replace the HttpDecoder with the WebSocket08FrameDecoder
1 parent 1b8db2d commit d8b32a4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/com/ning/http/client/providers/netty/NettyAsyncHttpProvider.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ public ChannelPipeline getPipeline() throws Exception {
303303
/* @Override */
304304
public ChannelPipeline getPipeline() throws Exception {
305305
ChannelPipeline pipeline = pipeline();
306-
pipeline.addLast("ws-decoder", new HttpResponseDecoder());
307-
pipeline.addLast("ws-encoder", new HttpRequestEncoder());
306+
pipeline.addLast("http-decoder", new HttpResponseDecoder());
307+
pipeline.addLast("http-encoder", new HttpRequestEncoder());
308308
pipeline.addLast("httpProcessor", NettyAsyncHttpProvider.this);
309309
return pipeline;
310310
}
@@ -384,8 +384,8 @@ public ChannelPipeline getPipeline() throws Exception {
384384
abort(cl.future(), ex);
385385
}
386386

387-
pipeline.addLast("ws-decoder", new HttpResponseDecoder());
388-
pipeline.addLast("ws-encoder", new HttpRequestEncoder());
387+
pipeline.addLast("http-decoder", new HttpResponseDecoder());
388+
pipeline.addLast("http-encoder", new HttpRequestEncoder());
389389
pipeline.addLast("httpProcessor", NettyAsyncHttpProvider.this);
390390

391391
return pipeline;
@@ -2451,8 +2451,8 @@ public void handle(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
24512451
throw new IOException(String.format("Invalid challenge. Actual: %s. Expected: %s", accept, key));
24522452
}
24532453

2454-
ctx.getPipeline().replace("ws-decoder", "ws-decoder", new WebSocket08FrameDecoder(false, false));
2455-
ctx.getPipeline().replace("ws-encoder", "ws-encoder", new WebSocket08FrameEncoder(true));
2454+
ctx.getPipeline().get(HttpResponseDecoder.class).replace("ws-decoder", new WebSocket08FrameDecoder(false, false));
2455+
ctx.getPipeline().replace("http-encoder", "ws-encoder", new WebSocket08FrameEncoder(true));
24562456
if (h.onHeadersReceived(responseHeaders) == STATE.CONTINUE) {
24572457
h.onSuccess(new NettyWebSocket(ctx.getChannel()));
24582458
}

0 commit comments

Comments
 (0)