Bug 62664 - @MultipartConfig, getParts(), and getParameter() on PUT requests
Summary: @MultipartConfig, getParts(), and getParameter() on PUT requests
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Servlet (show other bugs)
Version: 9.0.11
Hardware: Macintosh All
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-30 19:21 UTC by Robert Tupelo-Schneck
Modified: 2018-08-31 12:24 UTC (History)
0 users



Attachments
HttpServlet subclass which will echo parameters for POST and for PUT before and after calling getParts() (1.68 KB, text/plain)
2018-08-30 19:21 UTC, Robert Tupelo-Schneck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Tupelo-Schneck 2018-08-30 19:21:36 UTC
Created attachment 36123 [details]
HttpServlet subclass which will echo parameters for POST and for PUT before and after calling getParts()

This is about a servlet annotated with @MultipartConfig.

For POST requests, "parts with form-data as the Content-Disposition but without a filename" are available to getParameter*.

For PUT requests, such parts are not initially available to getParameter*.  If I call getParameter* before getParts(), they are never available to getParameter*, even after calling getParts().  If I call getParts() first, then they are available to getParameter*.

The servlet spec does not appear to require that PUT and POST should behave differently for multipart requests in servlets annotated with @MultipartConfig.  Even if it did, it seems very surprising that the call order of getParts() vs getParameter* would affect which parameters were available.

Tried on Tomcat 9.0.11 (and also some earlier versions), with Oracle Java 8.
Comment 1 Mark Thomas 2018-08-31 10:34:42 UTC
Thanks for the really good test case. I'll take a look.
Comment 2 Mark Thomas 2018-08-31 12:24:04 UTC
Fixed in:
- trunk for 9.0.12 onwards
- 8.5.x for 8.5.34 onwards
- 7.0.x for 7.0.91 onwards