Skip to content

Commit

Permalink
Add default to http max chunk size
Browse files Browse the repository at this point in the history
  • Loading branch information
pcasaes committed Jul 9, 2020
1 parent 0e0457c commit 31ec1f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class ServerLimitsConfig {
/**
* The max HTTP chunk size
*/
@ConfigItem
public Optional<MemorySize> maxChunkSize;
@ConfigItem(defaultValue = "8192")
public MemorySize maxChunkSize;

/**
* The maximum length of the initial line (e.g. {@code "GET / HTTP/1.0"}).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,7 @@ private static HttpServerOptions createSslOptions(HttpBuildTimeConfig buildTimeC
}
}
serverOptions.setMaxHeaderSize(httpConfiguration.limits.maxHeaderSize.asBigInteger().intValueExact());
Optional<MemorySize> maxChunkSize = httpConfiguration.limits.maxChunkSize;
if (maxChunkSize.isPresent()) {
serverOptions.setMaxChunkSize(maxChunkSize.get().asBigInteger().intValueExact());
}
serverOptions.setMaxChunkSize(httpConfiguration.limits.maxChunkSize.asBigInteger().intValueExact());
setIdleTimeout(httpConfiguration, serverOptions);

if (certFile.isPresent() && keyFile.isPresent()) {
Expand Down Expand Up @@ -708,10 +705,7 @@ private static HttpServerOptions createHttpServerOptions(HttpConfiguration httpC
options.setPort(httpConfiguration.determinePort(launchMode));
setIdleTimeout(httpConfiguration, options);
options.setMaxHeaderSize(httpConfiguration.limits.maxHeaderSize.asBigInteger().intValueExact());
Optional<MemorySize> maxChunkSize = httpConfiguration.limits.maxChunkSize;
if (maxChunkSize.isPresent()) {
options.setMaxChunkSize(maxChunkSize.get().asBigInteger().intValueExact());
}
options.setMaxChunkSize(httpConfiguration.limits.maxChunkSize.asBigInteger().intValueExact());
options.setWebsocketSubProtocols(websocketSubProtocols);
options.setReusePort(httpConfiguration.soReusePort);
options.setTcpQuickAck(httpConfiguration.tcpQuickAck);
Expand All @@ -730,10 +724,7 @@ private static HttpServerOptions createDomainSocketOptions(HttpConfiguration htt
options.setHost(httpConfiguration.domainSocket);
setIdleTimeout(httpConfiguration, options);
options.setMaxHeaderSize(httpConfiguration.limits.maxHeaderSize.asBigInteger().intValueExact());
Optional<MemorySize> maxChunkSize = httpConfiguration.limits.maxChunkSize;
if (maxChunkSize.isPresent()) {
options.setMaxChunkSize(maxChunkSize.get().asBigInteger().intValueExact());
}
options.setMaxChunkSize(httpConfiguration.limits.maxChunkSize.asBigInteger().intValueExact());
options.setWebsocketSubProtocols(websocketSubProtocols);
return options;
}
Expand Down

0 comments on commit 31ec1f3

Please sign in to comment.