|
23 | 23 | import io.netty.handler.codec.ByteToMessageDecoder; |
24 | 24 | import io.netty.handler.codec.http.HttpContentCompressor; |
25 | 25 | import io.netty.handler.codec.http.HttpContentDecompressor; |
| 26 | +import io.netty.handler.codec.http.HttpDecoderConfig; |
26 | 27 | import io.netty.handler.codec.http.HttpMessage; |
27 | 28 | import io.netty.handler.codec.http.HttpRequestDecoder; |
28 | 29 | import io.netty.handler.codec.http.HttpResponse; |
@@ -342,23 +343,19 @@ protected void initChannel(Channel ch) throws Exception { |
342 | 343 | ch.pipeline().addLast("read_timeout", new ReadTimeoutHandler(transport.readTimeoutMillis, TimeUnit.MILLISECONDS)); |
343 | 344 | } |
344 | 345 | final HttpRequestDecoder decoder; |
| 346 | + final HttpDecoderConfig decoderConfig = new HttpDecoderConfig().setMaxInitialLineLength(handlingSettings.maxInitialLineLength()) |
| 347 | + .setMaxHeaderSize(handlingSettings.maxHeaderSize()) |
| 348 | + .setMaxChunkSize(handlingSettings.maxChunkSize()) |
| 349 | + .setStrictLineParsing(false); |
345 | 350 | if (httpValidator != null) { |
346 | | - decoder = new HttpRequestDecoder( |
347 | | - handlingSettings.maxInitialLineLength(), |
348 | | - handlingSettings.maxHeaderSize(), |
349 | | - handlingSettings.maxChunkSize() |
350 | | - ) { |
| 351 | + decoder = new HttpRequestDecoder(decoderConfig) { |
351 | 352 | @Override |
352 | 353 | protected HttpMessage createMessage(String[] initialLine) throws Exception { |
353 | 354 | return HttpHeadersAuthenticatorUtils.wrapAsMessageWithAuthenticationContext(super.createMessage(initialLine)); |
354 | 355 | } |
355 | 356 | }; |
356 | 357 | } else { |
357 | | - decoder = new HttpRequestDecoder( |
358 | | - handlingSettings.maxInitialLineLength(), |
359 | | - handlingSettings.maxHeaderSize(), |
360 | | - handlingSettings.maxChunkSize() |
361 | | - ); |
| 358 | + decoder = new HttpRequestDecoder(decoderConfig); |
362 | 359 | } |
363 | 360 | decoder.setCumulator(ByteToMessageDecoder.COMPOSITE_CUMULATOR); |
364 | 361 | ch.pipeline().addLast("decoder", decoder); // parses the HTTP bytes request into HTTP message pieces |
|
0 commit comments