Skip to content

Commit

Permalink
Fix behavior of maxPostSize in Tomcat 10 (#144)
Browse files Browse the repository at this point in the history
Connector#setProperty is a bit of a lie. It does not set properties
on the Connector. Rather, the method set properties on the protocol
handler which is part of the connector.
Thus, the previous implementation tried to set a connector property
using setProperty, which was never successful.
Instead we directly set the property of the connector. To achieve
the original intent ("unlimited post size") the value must be
below zero. Compare:
http://tomcat.apache.org/tomcat-10.0-doc/config/http.html#Common_Attributes
  • Loading branch information
f4lco committed May 6, 2020
1 parent 104b0c9 commit 82e23dd
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class TomcatServerConfigurer {
if(params.httpIdleTimeout)
httpConn.setProperty('keepAliveTimeout', params.httpIdleTimeout.toString())

httpConn.setProperty('maxPostSize', '0') // unlimited post size
httpConn.maxPostSize = -1 // unlimited post size

if(newHttpConnector) {
service.addConnector(httpConn)
Expand Down Expand Up @@ -191,7 +191,7 @@ class TomcatServerConfigurer {
if(params.httpsIdleTimeout)
httpsConn.setProperty('keepAliveTimeout', params.httpsIdleTimeout.toString())

httpsConn.setProperty('maxPostSize', '0') // unlimited
httpsConn.maxPostSize = -1 // unlimited

if(newHttpsConnector) {
service.addConnector(httpsConn)
Expand Down

0 comments on commit 82e23dd

Please sign in to comment.