Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate code in NettyWebServerFactoryCustomizer #37434

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public void customize(NettyReactiveWebServerFactory factory) {
.to((maxKeepAliveRequests) -> customizeMaxKeepAliveRequests(factory, maxKeepAliveRequests));
if (this.serverProperties.getHttp2() != null && this.serverProperties.getHttp2().isEnabled()) {
map.from(this.serverProperties.getMaxHttpRequestHeaderSize())
.whenNonNull()
.to((size) -> customizeHttp2MaxHeaderSize(factory, size.toBytes()));
}
customizeRequestDecoder(factory, map);
Expand All @@ -87,23 +86,18 @@ private void customizeConnectionTimeout(NettyReactiveWebServerFactory factory, D
private void customizeRequestDecoder(NettyReactiveWebServerFactory factory, PropertyMapper propertyMapper) {
factory.addServerCustomizers((httpServer) -> httpServer.httpRequestDecoder((httpRequestDecoderSpec) -> {
propertyMapper.from(this.serverProperties.getMaxHttpRequestHeaderSize())
.whenNonNull()
.to((maxHttpRequestHeader) -> httpRequestDecoderSpec
.maxHeaderSize((int) maxHttpRequestHeader.toBytes()));
ServerProperties.Netty nettyProperties = this.serverProperties.getNetty();
propertyMapper.from(nettyProperties.getMaxInitialLineLength())
.whenNonNull()
.to((maxInitialLineLength) -> httpRequestDecoderSpec
.maxInitialLineLength((int) maxInitialLineLength.toBytes()));
propertyMapper.from(nettyProperties.getH2cMaxContentLength())
.whenNonNull()
.to((h2cMaxContentLength) -> httpRequestDecoderSpec
.h2cMaxContentLength((int) h2cMaxContentLength.toBytes()));
propertyMapper.from(nettyProperties.getInitialBufferSize())
.whenNonNull()
.to((initialBufferSize) -> httpRequestDecoderSpec.initialBufferSize((int) initialBufferSize.toBytes()));
propertyMapper.from(nettyProperties.isValidateHeaders())
.whenNonNull()
.to(httpRequestDecoderSpec::validateHeaders);
return httpRequestDecoderSpec;
}));
Expand Down