Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Commit fd2ecfd

Browse files
author
Norman Maurer
committed
Make sure no bytes are lost when replace the HttpDecoder with the WebSocket08FrameDecoder
1 parent 1404672 commit fd2ecfd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

providers/netty/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
@@ -277,8 +277,8 @@ void configureNetty() {
277277
/* @Override */
278278
public ChannelPipeline getPipeline() throws Exception {
279279
ChannelPipeline pipeline = pipeline();
280-
pipeline.addLast("ws-decoder", new HttpResponseDecoder());
281-
pipeline.addLast("ws-encoder", new HttpRequestEncoder());
280+
pipeline.addLast("http-decoder", new HttpResponseDecoder());
281+
pipeline.addLast("http-encoder", new HttpRequestEncoder());
282282
pipeline.addLast("httpProcessor", NettyAsyncHttpProvider.this);
283283
return pipeline;
284284
}
@@ -354,8 +354,8 @@ public ChannelPipeline getPipeline() throws Exception {
354354
abort(cl.future(), ex);
355355
}
356356

357-
pipeline.addLast("ws-decoder", new HttpResponseDecoder());
358-
pipeline.addLast("ws-encoder", new HttpRequestEncoder());
357+
pipeline.addLast("http-decoder", new HttpResponseDecoder());
358+
pipeline.addLast("http-encoder", new HttpRequestEncoder());
359359
pipeline.addLast("httpProcessor", NettyAsyncHttpProvider.this);
360360

361361
return pipeline;
@@ -2390,8 +2390,8 @@ public void handle(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
23902390
throw new IOException(String.format("Invalid challenge. Actual: %s. Expected: %s", accept, key));
23912391
}
23922392

2393-
ctx.getPipeline().replace("ws-decoder", "ws-decoder", new WebSocket08FrameDecoder(false, false));
2394-
ctx.getPipeline().replace("ws-encoder", "ws-encoder", new WebSocket08FrameEncoder(true));
2393+
ctx.getPipeline().get(HttpResponseDecoder.class).replace("ws-decoder", new WebSocket08FrameDecoder(false, false));
2394+
ctx.getPipeline().replace("http-encoder", "ws-encoder", new WebSocket08FrameEncoder(true));
23952395
if (h.onHeadersReceived(responseHeaders) == STATE.CONTINUE) {
23962396
h.onSuccess(new NettyWebSocket(ctx.getChannel()));
23972397
}

0 commit comments

Comments
 (0)