Skip to content

Commit

Permalink
applied htt decoder config in initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamhead committed Dec 26, 2023
1 parent 6339ed9 commit 381a70e
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpDecoderConfig;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpServerCodec;

Expand Down Expand Up @@ -34,9 +35,11 @@ protected void initChannel(final SocketChannel ch) {
}

ServerConfig serverConfig = serverSetting.getServerConfig();
pipeline.addLast("codec", new HttpServerCodec(MAX_INITIAL_LINE_LENGTH,
serverConfig.getHeaderSize(),
MAX_CHUNK_SIZE, false));
HttpDecoderConfig config = new HttpDecoderConfig().setMaxInitialLineLength(MAX_INITIAL_LINE_LENGTH)
.setMaxChunkSize(MAX_CHUNK_SIZE)
.setMaxHeaderSize(serverConfig.getHeaderSize())
.setValidateHeaders(false);
pipeline.addLast("codec", new HttpServerCodec(config));
pipeline.addLast("aggregator", new HttpObjectAggregator(serverConfig.getContentLength()));
pipeline.addLast("handler", new MocoHandler(serverSetting));
}
Expand Down

0 comments on commit 381a70e

Please sign in to comment.