Polish "Add config props for keep-alive timeout and max keep-alive reqs"
See gh-25815
This commit is contained in:
@@ -372,18 +372,15 @@ public class ServerProperties {
|
||||
private int processorCache = 200;
|
||||
|
||||
/**
|
||||
* The number of milliseconds this Connector will wait for another HTTP request
|
||||
* before closing the connection. The default value is to use the value that has
|
||||
* been set for the connectionTimeout attribute. Use a value of -1 to indicate no
|
||||
* (i.e. infinite) timeout.
|
||||
* Time to wait for another HTTP request before the connection is closed. When not
|
||||
* set the connectionTimeout is used. When set to -1 there will be no timeout.
|
||||
*/
|
||||
private Duration keepAliveTimeout;
|
||||
|
||||
/**
|
||||
* The maximum number of HTTP requests which can be pipelined until the connection
|
||||
* is closed by the server./ Setting this attribute to 1 will disable HTTP/1.0
|
||||
* keep-alive as well as HTTP/1.1 keep-alive and pipelining. Setting this to -1
|
||||
* will allow an unlimited amount of pipelined or keep-alive HTTP requests.
|
||||
* Maximum number of HTTP requests that can be pipelined before the connection is
|
||||
* closed. When set to 0 or 1, keep-alive and pipelining are disabled. When set to
|
||||
* -1, an unlimited number of pipelined or keep-alive requests is allowed.
|
||||
*/
|
||||
private int maxKeepAliveRequests = 100;
|
||||
|
||||
|
||||
@@ -233,6 +233,12 @@ class ServerPropertiesTests {
|
||||
|
||||
@Test
|
||||
void customizeMaxKeepAliveRequests() {
|
||||
bind("server.tomcat.max-keep-alive-requests", "200");
|
||||
assertThat(this.properties.getTomcat().getMaxKeepAliveRequests()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
void customizeMaxKeepAliveRequestsWithInfinite() {
|
||||
bind("server.tomcat.max-keep-alive-requests", "-1");
|
||||
assertThat(this.properties.getTomcat().getMaxKeepAliveRequests()).isEqualTo(-1);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ class TomcatWebServerFactoryCustomizerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void customizeKeepAliveTimeout() {
|
||||
void customKeepAliveTimeout() {
|
||||
bind("server.tomcat.keep-alive-timeout=30ms");
|
||||
customizeAndRunServer((server) -> assertThat(
|
||||
((AbstractProtocol<?>) server.getTomcat().getConnector().getProtocolHandler()).getKeepAliveTimeout())
|
||||
@@ -107,7 +107,7 @@ class TomcatWebServerFactoryCustomizerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void customizeMaxKeepAliveRequests() {
|
||||
void customMaxKeepAliveRequests() {
|
||||
bind("server.tomcat.max-keep-alive-requests=-1");
|
||||
customizeAndRunServer((server) -> assertThat(
|
||||
((AbstractHttp11Protocol<?>) server.getTomcat().getConnector().getProtocolHandler())
|
||||
|
||||
Reference in New Issue
Block a user