简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM