From 31ec1f3e23f7fc650ae48df3da570fd82a69f7e8 Mon Sep 17 00:00:00 2001 From: Paulo Casaes Date: Thu, 9 Jul 2020 18:55:15 -0300 Subject: [PATCH] Add default to http max chunk size --- .../vertx/http/runtime/ServerLimitsConfig.java | 4 ++-- .../vertx/http/runtime/VertxHttpRecorder.java | 15 +++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerLimitsConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerLimitsConfig.java index 78e9d779f83a7..b4a90829267d3 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerLimitsConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerLimitsConfig.java @@ -23,8 +23,8 @@ public class ServerLimitsConfig { /** * The max HTTP chunk size */ - @ConfigItem - public Optional maxChunkSize; + @ConfigItem(defaultValue = "8192") + public MemorySize maxChunkSize; /** * The maximum length of the initial line (e.g. {@code "GET / HTTP/1.0"}). diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java index 105630dc6d881..661d99c303131 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java @@ -547,10 +547,7 @@ private static HttpServerOptions createSslOptions(HttpBuildTimeConfig buildTimeC } } serverOptions.setMaxHeaderSize(httpConfiguration.limits.maxHeaderSize.asBigInteger().intValueExact()); - Optional 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()) { @@ -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 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); @@ -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 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; }