tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: POST request fails if content is ignored?
Date Mon, 09 Sep 2019 13:55:59 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

André,

On 9/9/19 07:59, André Warnier (tomcat) wrote:
> Hi. Did you check : 
> https://tomcat.apache.org/tomcat-8.5-doc/config/http.html#Common_Attri
butes
>
> 
- --> 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 know of no browser that encodes a file in any way when performing a
standard file-upload via an <input type="file"/> control. HTTP handled
binary content just fine.

> I do not know (and the doc does not say) if the maxPostSize
> attribute refers to the POST content still encoded or already
> decoded.

That setting counts bytes on the wire.

- -chris

> 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-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl12We8ACgkQHPApP6U8
pFhbsxAAta8C4RjgQ7DPpoZ/gtE9M6oFfICUeX1gRCB4YYu6nWY4O+8r/CK+hGHV
yuWUchWQaeTG+sSIrXL2tvaIbQEIUzLLEDd6H/nSbCIL/rOF3AXs4AbGfsyLcUji
L7c9G334aBWQoGS6TfYrXAHZfI7YmtPqc4rXgQqJwRkOCGg0oLL8e7YKLyffPb2U
BFnSaMFaXHIPIoKEC3lLl39r6fCikpgx/MJ7wqLrU3Oux6tr3srcAFFlnhGpmUG9
vcoXULMxo890gd4uspyfbV5OL5BektFLG4u5t1wu4vVdC+G/+l0uTd1i3J9w6+cM
GbBMjeIH1g87/bb+rvrszMGn5XEcEs3i1UwZIy0UNY0oVcGJkV4V5iu2e5VVCp8k
ZcrG56bCptKL9CkTQafhPeztfhRPJya4UVUm9MeVKu1mQsKWZrya2840hDeKzv9V
FhTsqLlS0GeUn3dFpKItQ5ngH4jpT3Lm4VQ2hrTt4h529YpgD0FMk8i+BdeuFnCF
hsHbTxJLnmw8fZ+H5mGLNzB4DTWVVJVTmCa0xcI/zO2S6Arp8q1jyxiSOurlTNZ6
pD0Y45NwTpwtwWhjhgWNQilLHtc1Nc3KOMcERX+0++cqJWrM2bxMcm/YQ/QK9yXA
nPWD8BMelyL9MhdvyjeGKoH6zqQ0uAhT6/iYFDqOw3gTMOtwEkk=
=1NdL
-----END PGP SIGNATURE-----

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


Mime
View raw message