Hi.
Did you check :
https://tomcat.apache.org/tomcat-8.5-doc/config/http.html#Common_Attributes
--> maxPostSize

Note : normally, the browser will encode (Base64 or similar) the content of a file and send the encoded content, which tends to be significantly larger (in bytes) than the original file (say + 30%). I do not know (and the doc does not say) if the maxPostSize attribute refers to the POST content still encoded or already decoded.


On 09.09.2019 12:53, Leon Atherton wrote:
Hello,

I've discovered an interesting issue where POST requests fail when
uploading a file over about ~6MB if the server ignores the request content.

I've put together a simple project to reproduce it:
https://github.com/leonatherton/tomcat-request-issue

Serverside code:
https://github.com/leonatherton/tomcat-request-issue/blob/master/src/main/java/DemoServlet.java
Clientside code:
https://github.com/leonatherton/tomcat-request-issue/blob/master/src/main/webapp/index.html

If you'd like to try it yourself there are a couple of pre-built war
files on the releases page, and there are steps to reproduce in the
README.md file.

The problem does not occur when uploading a small file, and the problem
can be "fixed" by simply getting a parameter from the request object. It
reproduces in Tomcat 8 & 9. The problem does not reproduce on Payara,
but I am seeing similar on Jetty.

My guess is that the server responds before the client has finished
uploading the file. The browsers see the incomplete upload and report
this as an error, despite content being sent in response. And my guess
is that inspecting a request parameter causes the server to wait for the
full upload before sending the response.

It's a slightly odd workflow, but it's not too unreasonable to sometimes
respond early and ignore the request content.

Is this expected behavior, or a bug in Tomcat?

Thanks!
Leon

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to