17

What does that parameter mean for tomcat. It was declared in server.xml as follows:

 <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>

So, I tried to change it

 <Connector connectionTimeout="2" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>

and didn't notice any effect. I expected that each page the load takes for more than 2 milliseconds would produce 504 - connection timeout error. But it didn't. I'm using eclipse and modify that file through it.

St.Antario
  • 26,175
  • 41
  • 130
  • 318

2 Answers2

17

This parameter is there specifically to fight one type of Denial-Of-Service attack, whereby some malicious client(s) create a TCP connection to the server (which has the effect of reserving some resources on the server for handling this connection), and then just sit there without sending any HTTP request on that connection. By making this delay shorter, you shorten the time during which the server resources are allocated, to serve a request that will never come.

hooknc
  • 4,854
  • 5
  • 31
  • 60
Vali7394
  • 441
  • 5
  • 10
13

Taken from here: https://tomcat.apache.org/tomcat-7.0-doc/config/http.html

connectionTimeout

The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. Use a value of -1 to indicate no (i.e. infinite) timeout. The default value is 60000 (i.e. 60 seconds) but note that the standard server.xml that ships with Tomcat sets this to 20000 (i.e. 20 seconds). Unless disableUploadTimeout is set to false, this timeout will also be used when reading the request body (if any).

informatik01
  • 16,038
  • 10
  • 74
  • 104
this.user3272243
  • 1,166
  • 2
  • 9
  • 24