From ffbef7bb8007a4ade99049bc1303a63b00cdde34 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 27 Jun 2023 13:50:04 +0100 Subject: [PATCH] Test server.max-http-request-header-size with Undertow Closes gh-36047 --- ...ndertowWebServerFactoryCustomizerTests.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/UndertowWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/UndertowWebServerFactoryCustomizerTests.java index 15289d60e41..934f0689223 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/UndertowWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/UndertowWebServerFactoryCustomizerTests.java @@ -103,6 +103,24 @@ class UndertowWebServerFactoryCustomizerTests { assertThat(boundServerOption(UndertowOptions.MAX_HEADER_SIZE)).isNull(); } + @Test + void customMaxHttpRequestHeaderSize() { + bind("server.max-http-request-header-size=2048"); + assertThat(boundServerOption(UndertowOptions.MAX_HEADER_SIZE)).isEqualTo(2048); + } + + @Test + void customMaxHttpRequestHeaderSizeIgnoredIfNegative() { + bind("server.max-http-request-header-size=-1"); + assertThat(boundServerOption(UndertowOptions.MAX_HEADER_SIZE)).isNull(); + } + + @Test + void customMaxHttpRequestHeaderSizeIgnoredIfZero() { + bind("server.max-http-request-header-size=0"); + assertThat(boundServerOption(UndertowOptions.MAX_HEADER_SIZE)).isNull(); + } + @Test void customMaxHttpPostSize() { bind("server.undertow.max-http-post-size=256");