Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
19942193
Commit
19942193
authored
Apr 06, 2021
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Add config props for keep-alive timeout and max keep-alive reqs"
See gh-25815
parent
34b94d88
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
ServerProperties.java
...ingframework/boot/autoconfigure/web/ServerProperties.java
+5
-8
ServerPropertiesTests.java
...amework/boot/autoconfigure/web/ServerPropertiesTests.java
+6
-0
TomcatWebServerFactoryCustomizerTests.java
...e/web/embedded/TomcatWebServerFactoryCustomizerTests.java
+2
-2
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java
View file @
19942193
...
@@ -372,18 +372,15 @@ public class ServerProperties {
...
@@ -372,18 +372,15 @@ public class ServerProperties {
private
int
processorCache
=
200
;
private
int
processorCache
=
200
;
/**
/**
* The number of milliseconds this Connector will wait for another HTTP request
* Time to wait for another HTTP request before the connection is closed. When not
* before closing the connection. The default value is to use the value that has
* set the connectionTimeout is used. When set to -1 there will be no timeout.
* been set for the connectionTimeout attribute. Use a value of -1 to indicate no
* (i.e. infinite) timeout.
*/
*/
private
Duration
keepAliveTimeout
;
private
Duration
keepAliveTimeout
;
/**
/**
* The maximum number of HTTP requests which can be pipelined until the connection
* Maximum number of HTTP requests that can be pipelined before the connection is
* is closed by the server./ Setting this attribute to 1 will disable HTTP/1.0
* closed. When set to 0 or 1, keep-alive and pipelining are disabled. When set to
* keep-alive as well as HTTP/1.1 keep-alive and pipelining. Setting this to -1
* -1, an unlimited number of pipelined or keep-alive requests is allowed.
* will allow an unlimited amount of pipelined or keep-alive HTTP requests.
*/
*/
private
int
maxKeepAliveRequests
=
100
;
private
int
maxKeepAliveRequests
=
100
;
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java
View file @
19942193
...
@@ -233,6 +233,12 @@ class ServerPropertiesTests {
...
@@ -233,6 +233,12 @@ class ServerPropertiesTests {
@Test
@Test
void
customizeMaxKeepAliveRequests
()
{
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"
);
bind
(
"server.tomcat.max-keep-alive-requests"
,
"-1"
);
assertThat
(
this
.
properties
.
getTomcat
().
getMaxKeepAliveRequests
()).
isEqualTo
(-
1
);
assertThat
(
this
.
properties
.
getTomcat
().
getMaxKeepAliveRequests
()).
isEqualTo
(-
1
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java
View file @
19942193
...
@@ -99,7 +99,7 @@ class TomcatWebServerFactoryCustomizerTests {
...
@@ -99,7 +99,7 @@ class TomcatWebServerFactoryCustomizerTests {
}
}
@Test
@Test
void
custom
ize
KeepAliveTimeout
()
{
void
customKeepAliveTimeout
()
{
bind
(
"server.tomcat.keep-alive-timeout=30ms"
);
bind
(
"server.tomcat.keep-alive-timeout=30ms"
);
customizeAndRunServer
((
server
)
->
assertThat
(
customizeAndRunServer
((
server
)
->
assertThat
(
((
AbstractProtocol
<?>)
server
.
getTomcat
().
getConnector
().
getProtocolHandler
()).
getKeepAliveTimeout
())
((
AbstractProtocol
<?>)
server
.
getTomcat
().
getConnector
().
getProtocolHandler
()).
getKeepAliveTimeout
())
...
@@ -107,7 +107,7 @@ class TomcatWebServerFactoryCustomizerTests {
...
@@ -107,7 +107,7 @@ class TomcatWebServerFactoryCustomizerTests {
}
}
@Test
@Test
void
custom
ize
MaxKeepAliveRequests
()
{
void
customMaxKeepAliveRequests
()
{
bind
(
"server.tomcat.max-keep-alive-requests=-1"
);
bind
(
"server.tomcat.max-keep-alive-requests=-1"
);
customizeAndRunServer
((
server
)
->
assertThat
(
customizeAndRunServer
((
server
)
->
assertThat
(
((
AbstractHttp11Protocol
<?>)
server
.
getTomcat
().
getConnector
().
getProtocolHandler
())
((
AbstractHttp11Protocol
<?>)
server
.
getTomcat
().
getConnector
().
getProtocolHandler
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment