[Bug 64384] is ignored when there is no element specified

2020-04-27 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64384

--- Comment #4 from Christopher Schultz  ---
Created attachment 37199
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37199&action=edit
Proposed patch

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 64384] is ignored when there is no element specified

2020-04-27 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64384

--- Comment #3 from Christopher Schultz  ---
I think I've found the problem, at ContextConfig:1355:

1355MultipartDef multipartdef = servlet.getMultipartDef();
1356if (multipartdef != null) {
1357 if (multipartdef.getMaxFileSize() != null &&
1358multipartdef.getMaxRequestSize()!= null &&
1359multipartdef.getFileSizeThreshold() != null) {
1360wrapper.setMultipartConfigElement(new
MultipartConfigElement(
multipartdef.getLocation(),
Long.parseLong(multipartdef.getMaxFileSize()),
Long.parseLong(multipartdef.getMaxRequestSize()),
Integer.parseInt(
multipartdef.getFileSizeThreshold(;
} else {
wrapper.setMultipartConfigElement(new
MultipartConfigElement(
multipartdef.getLocation()));
}
}

When execution reaches 1355, the MultipartDef object contains the expected
values:

maxFileSize=1048576
maxRequestSize=1049600
fileSizeThreshold=null

The predicate on lines 1357 - 1359 cause this configuration to not be applied
if any of the items are missing.

The servlet spec allows any of these items to be missing, so I believe this is
a bug and spec violation together in one.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 64384] is ignored when there is no element specified

2020-04-27 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64384

--- Comment #2 from Remy Maucherat  ---
Ok, ok, the check here looks inaccurate:
https://github.com/apache/tomcat/blob/master/java/org/apache/catalina/startup/ContextConfig.java#L1365

Unless all are set, only the location would be used.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 64384] is ignored when there is no element specified

2020-04-27 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=64384

--- Comment #1 from Christopher Schultz  ---
Created attachment 37198
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37198&action=edit
Sample WAR file which reproduces the issue

This WAR file (including source) will work as expected:

1. Deploy the WAR file
2. Navigate to /test which will load index.html
3. Choose an arbitrary file and upload
4a. A small enough file will yield a debug output
4b. A large enough file (> 1MiB) will cause an error

If you edit WEB-INF/web.xml to remove the , you will be
able to upload any size file without error.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org