Skip to content

Commit f7a4a64

Browse files
committed
Don't require HttpChunkAggregator to be present in pipeline for Web Sockets.
1 parent 549546f commit f7a4a64

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ public ChannelFuture handshake(Channel channel, HttpRequest req) {
164164

165165
// Upgrade the connection and send the handshake response.
166166
ChannelPipeline p = channel.getPipeline();
167-
p.remove(HttpChunkAggregator.class);
167+
if (p.get(HttpChunkAggregator.class) != null) {
168+
p.remove(HttpChunkAggregator.class);
169+
}
168170
p.replace(HttpRequestDecoder.class, "wsdecoder", new WebSocket00FrameDecoder());
169171

170172
ChannelFuture future = channel.write(res);

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker08.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ public ChannelFuture handshake(Channel channel, HttpRequest req) {
138138

139139
// Upgrade the connection and send the handshake response.
140140
ChannelPipeline p = channel.getPipeline();
141-
p.remove(HttpChunkAggregator.class);
141+
if (p.get(HttpChunkAggregator.class) != null) {
142+
p.remove(HttpChunkAggregator.class);
143+
}
144+
142145
p.replace(HttpRequestDecoder.class, "wsdecoder", new WebSocket08FrameDecoder(true, allowExtensions));
143146
p.replace(HttpResponseEncoder.class, "wsencoder", new WebSocket08FrameEncoder(false));
144147

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ public ChannelFuture handshake(Channel channel, HttpRequest req) {
139139

140140
// Upgrade the connection and send the handshake response.
141141
ChannelPipeline p = channel.getPipeline();
142-
p.remove(HttpChunkAggregator.class);
142+
if (p.get(HttpChunkAggregator.class) != null) {
143+
p.remove(HttpChunkAggregator.class);
144+
}
145+
143146
p.replace(HttpRequestDecoder.class, "wsdecoder", new WebSocket13FrameDecoder(true, allowExtensions));
144147
p.replace(HttpResponseEncoder.class, "wsencoder", new WebSocket13FrameEncoder(false));
145148

0 commit comments

Comments
 (0)