Behrang Saeedzadeh
Behrang Saeedzadeh

Reputation: 47913

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.

Upvotes: 4

Views: 4961

Answers (2)

Reece45
Reece45

Reputation: 2779

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)

Upvotes: 5

ryanprayogo
ryanprayogo

Reputation: 11817

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.

Upvotes: -1

Related Questions