What's the purpose of the maxPostSize for Tomcat's HTTP Connector?
According to Tomcat docs:
The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
But what's "the container FORM URL parameter parsing"? Any ideas what is the purpose of "maxPostSize"开发者_运维知识库?
Thanks in advance.
Its a set limit on where to stop parsing the POST. Just in case some hacker decides to start sending a request with POST data and just continuously sending POST data. Tomcat won't just take forever parsing POST. Having the limit prevents a denial of service attacks. (They keep doing this until your server maxes stops responding for whatever reason)
It means that when you have something like:
<form type="post" ...>
<input name="something" value="someVal" type="text"/>
</form>
in your HTML, if someVal
is more than 2MB in size (say, a very long string), only the first 2MB of that data will be available when you do request.getAttribute("something")
in your servlet.
精彩评论