Ensure the HttpResponseEncoder is always placed before the HttpObjectAggregator. Part of [#2219]
This commit is contained in:
parent
37ee6ef79a
commit
7c4ad004f6
@ -75,10 +75,9 @@ public class HttpServerInitializer extends ChannelInitializer<SocketChannel> {
|
|||||||
ChannelPipeline pipeline = ch.pipeline();
|
ChannelPipeline pipeline = ch.pipeline();
|
||||||
|
|
||||||
CorsConfig corsConfig = CorsConfig.anyOrigin().build();
|
CorsConfig corsConfig = CorsConfig.anyOrigin().build();
|
||||||
|
pipeline.addLast("encoder", new HttpResponseEncoder());
|
||||||
pipeline.addLast("decoder", new HttpRequestDecoder());
|
pipeline.addLast("decoder", new HttpRequestDecoder());
|
||||||
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
||||||
pipeline.addLast("encoder", new HttpResponseEncoder());
|
|
||||||
pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
|
pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
|
||||||
pipeline.addLast("cors", new CorsHandler(corsConfig));
|
pipeline.addLast("cors", new CorsHandler(corsConfig));
|
||||||
pipeline.addLast("handler", new OkResponseHandler());
|
pipeline.addLast("handler", new OkResponseHandler());
|
||||||
|
@ -34,9 +34,9 @@ public class HttpStaticFileServerInitializer extends ChannelInitializer<SocketCh
|
|||||||
//engine.setUseClientMode(false);
|
//engine.setUseClientMode(false);
|
||||||
//pipeline.addLast("ssl", new SslHandler(engine));
|
//pipeline.addLast("ssl", new SslHandler(engine));
|
||||||
|
|
||||||
|
pipeline.addLast("encoder", new HttpResponseEncoder());
|
||||||
pipeline.addLast("decoder", new HttpRequestDecoder());
|
pipeline.addLast("decoder", new HttpRequestDecoder());
|
||||||
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
||||||
pipeline.addLast("encoder", new HttpResponseEncoder());
|
|
||||||
pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
|
pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
|
||||||
|
|
||||||
pipeline.addLast("handler", new HttpStaticFileServerHandler(true)); // Specify false if SSL.
|
pipeline.addLast("handler", new HttpStaticFileServerHandler(true)); // Specify false if SSL.
|
||||||
|
@ -68,9 +68,9 @@ public class WebSocketServer {
|
|||||||
@Override
|
@Override
|
||||||
public void initChannel(final SocketChannel ch) throws Exception {
|
public void initChannel(final SocketChannel ch) throws Exception {
|
||||||
ch.pipeline().addLast(
|
ch.pipeline().addLast(
|
||||||
|
new HttpResponseEncoder(),
|
||||||
new HttpRequestDecoder(),
|
new HttpRequestDecoder(),
|
||||||
new HttpObjectAggregator(65536),
|
new HttpObjectAggregator(65536),
|
||||||
new HttpResponseEncoder(),
|
|
||||||
new WebSocketServerProtocolHandler("/websocket"),
|
new WebSocketServerProtocolHandler("/websocket"),
|
||||||
new CustomTextFrameHandler());
|
new CustomTextFrameHandler());
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,9 @@ public class WebSocketSslServerInitializer extends ChannelInitializer<SocketChan
|
|||||||
SSLEngine engine = WebSocketSslServerSslContext.getInstance().serverContext().createSSLEngine();
|
SSLEngine engine = WebSocketSslServerSslContext.getInstance().serverContext().createSSLEngine();
|
||||||
engine.setUseClientMode(false);
|
engine.setUseClientMode(false);
|
||||||
pipeline.addLast("ssl", new SslHandler(engine));
|
pipeline.addLast("ssl", new SslHandler(engine));
|
||||||
|
pipeline.addLast("encoder", new HttpResponseEncoder());
|
||||||
pipeline.addLast("decoder", new HttpRequestDecoder());
|
pipeline.addLast("decoder", new HttpRequestDecoder());
|
||||||
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
||||||
pipeline.addLast("encoder", new HttpResponseEncoder());
|
|
||||||
pipeline.addLast("handler", new WebSocketSslServerHandler());
|
pipeline.addLast("handler", new WebSocketSslServerHandler());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,9 @@ public class AutobahnServerInitializer extends ChannelInitializer<SocketChannel>
|
|||||||
@Override
|
@Override
|
||||||
public void initChannel(SocketChannel ch) throws Exception {
|
public void initChannel(SocketChannel ch) throws Exception {
|
||||||
ChannelPipeline pipeline = ch.pipeline();
|
ChannelPipeline pipeline = ch.pipeline();
|
||||||
|
pipeline.addLast("encoder", new HttpResponseEncoder());
|
||||||
pipeline.addLast("decoder", new HttpRequestDecoder());
|
pipeline.addLast("decoder", new HttpRequestDecoder());
|
||||||
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
||||||
pipeline.addLast("encoder", new HttpResponseEncoder());
|
|
||||||
pipeline.addLast("handler", new AutobahnServerHandler());
|
pipeline.addLast("handler", new AutobahnServerHandler());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user