Mantis - Resin
Viewing Issue Advanced Details
6077 minor always 07-27-17 14:04 11-21-17 09:43
none 4.0.54  
0006077: multipart/form-data caucho.multipart.form.error
(rep by Steffen Busch)
Please fill "caucho.multipart.form.error" and "caucho.multipart.form.error.size" in case of IllegalStateException as well.

I'm trying to use the Servlet 3.0+ Capabilities of the multipart/form-data requests and looked up several Caucho resources such as:
 1: [^]
 2: [^]

I would really like to use the two offered Request attributes as mentioned on the 2: Link to improve error messages to users.

If the upload is larger than the limit or if multipart-form processing is disabled, Resin will not parse the request and will set an error message in the "caucho.multipart.form.error" request attribute. The "caucho.multipart.form.error.size" will contain the attempted upload size.

However, the "caucho.multipart.form.error" and "caucho.multipart.form.error.size" request attributes are empty in the following two situations:

Sitation 1: IllegalStateException (caused by

For example if a single File (Part) is processed and the Size is greater than <max-file-size>10M</max-file-size> from the Servlet's <multipart-config>

java.lang.IllegalStateException: multipart form data part 'File':'11148012' is greater then the accepted value of '10485760'
  at com.caucho.server.http.MultipartFormParser.parsePostData(
  at com.caucho.server.http.AbstractCauchoRequest.parsePostQueryImpl(
  at com.caucho.server.http.AbstractCauchoRequest.parseQueryImpl(
  at com.caucho.server.http.AbstractCauchoRequest.getParts(

Sitation 2: IllegalStateException (caused by

For example if several files (Parts) are processed (none of them is bigger than <max-file-size> see Situation 1) but the total size is greater than <max-request-size>10M</max-request-size> from the Servlet's <multipart-config>

java.lang.IllegalStateException: multipart form data request's Content-Length '20780351' is greater then configured in @MultipartConfig.maxRequestSize value: '10485760'
  at com.caucho.server.http.AbstractCauchoRequest.parsePostQueryImpl(
  at com.caucho.server.http.AbstractCauchoRequest.parseQueryImpl(
  at com.caucho.server.http.AbstractCauchoRequest.getParts(

Stacktraces obtained from Caucho Resin 4.0.50

It would be great if you can fill "caucho.multipart.form.error" and "caucho.multipart.form.error.size" request attributes in both cases.

Whenever I experienced an IOException from MultipartFormParser caused by "throw formError" at least the "caucho.multipart.form.error" attribute was present and most of the time the "caucho.multipart.form.error.size" too.
For example:
 * multipart form data '{0}' too large
 * multipart form upload failed (possibly due to full disk)
 * multipart form upload failed because field '{0}' exceeds max length {1}
 * End of post before multipart-mime boundary

08-02-17 14:25