https://issues.apache.org/bugzilla/show_bug.cgi?id=57438

            Bug ID: 57438
           Summary: Inifinite redirect loop when maximum upload size
                    exceeded
           Product: Tomcat 7
           Version: 7.0.55
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlet & JSP API
          Assignee: dev@tomcat.apache.org
          Reporter: martinvis...@gmail.com

Created attachment 32366
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32366&action=edit
The stack trace of the loop

Running a Spring MVC 4.1.4 web application on JDK 7, Ubuntu 14.10 (and Debian
Wheezy).
Tested on version 7.0.53 through 7.0.57. The web application works as expected
in versions 7.0.53 and 7.0.54. Version 7.0.55 and up display the following
issue.

When uploading a large file, larger than the specified maximum, the exception
org.springframework.web.multipart.MaxUploadSizeExceededException (caused by a
org.apache.commons.fileupload.FileUploadBase.SizeLimitExceededException) is
caught via an @ExceptionHandler. After logging the exception and resolving some
parameters from the inputstream a redirect is performed like this:

return new org.springframework.web.servlet.ModelAndView("redirect:/error", new
org.springframework.ui.ExtendedModelMap());

I expect that this would generate a HTTP 302 redirect and will trigger a GET
request on "/error". The upload obviously is a POST request and the redirect
would perform a GET request. Tomcat version 7.0.54 and .53 indeed do that, but
in version 55 and up it remains a POST request. The complete multipart
content-type is saved and the whole request is repeated until the server throws
an error: (failed) net::ERR_CONNECTION_RESET.

Provisional headers:
Request URL:https://localhost:8443/import/ratings
Request Headers
Provisional headers are shown
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Content-Type:multipart/form-data;
boundary=----WebKitFormBoundaryNT3MUmtXDpFSSCLy
Origin:https://localhost:8443
Referer:https://localhost:8443/import/ratings
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/39.0.2171.95 Safari/537.36
Request Payload
------WebKitFormBoundaryNT3MUmtXDpFSSCLy
Content-Disposition: form-data; name="commandName"

importRatingsCommand
------WebKitFormBoundaryNT3MUmtXDpFSSCLy
Content-Disposition: form-data; name="ratings"; filename="file.pdf"
Content-Type: application/pdf

-- 
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

Reply via email to