|
|
|
|
@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.web.embedded;
@@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.web.embedded;
|
|
|
|
|
import java.time.Duration; |
|
|
|
|
|
|
|
|
|
import io.netty.channel.ChannelOption; |
|
|
|
|
import reactor.netty.http.server.HttpRequestDecoderSpec; |
|
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.web.ServerProperties; |
|
|
|
|
import org.springframework.boot.cloud.CloudPlatform; |
|
|
|
|
@ -86,8 +87,7 @@ public class NettyWebServerFactoryCustomizer
@@ -86,8 +87,7 @@ public class NettyWebServerFactoryCustomizer
|
|
|
|
|
.to((maxHttpRequestHeader) -> httpRequestDecoderSpec |
|
|
|
|
.maxHeaderSize((int) maxHttpRequestHeader.toBytes())); |
|
|
|
|
ServerProperties.Netty nettyProperties = this.serverProperties.getNetty(); |
|
|
|
|
propertyMapper.from(nettyProperties.getMaxChunkSize()).whenNonNull() |
|
|
|
|
.to((maxChunkSize) -> httpRequestDecoderSpec.maxChunkSize((int) maxChunkSize.toBytes())); |
|
|
|
|
maxChunkSize(propertyMapper, httpRequestDecoderSpec, nettyProperties); |
|
|
|
|
propertyMapper.from(nettyProperties.getMaxInitialLineLength()).whenNonNull() |
|
|
|
|
.to((maxInitialLineLength) -> httpRequestDecoderSpec |
|
|
|
|
.maxInitialLineLength((int) maxInitialLineLength.toBytes())); |
|
|
|
|
@ -102,6 +102,13 @@ public class NettyWebServerFactoryCustomizer
@@ -102,6 +102,13 @@ public class NettyWebServerFactoryCustomizer
|
|
|
|
|
})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
|
private void maxChunkSize(PropertyMapper propertyMapper, HttpRequestDecoderSpec httpRequestDecoderSpec, |
|
|
|
|
ServerProperties.Netty nettyProperties) { |
|
|
|
|
propertyMapper.from(nettyProperties.getMaxChunkSize()).whenNonNull() |
|
|
|
|
.to((maxChunkSize) -> httpRequestDecoderSpec.maxChunkSize((int) maxChunkSize.toBytes())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void customizeIdleTimeout(NettyReactiveWebServerFactory factory, Duration idleTimeout) { |
|
|
|
|
factory.addServerCustomizers((httpServer) -> httpServer.idleTimeout(idleTimeout)); |
|
|
|
|
} |
|
|
|
|
|