You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/01/13 09:31:46 UTC

[Bug 57438] New: Inifinite redirect loop when maximum upload size exceeded

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: martinvisser@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 57438] Infinite redirect loop when maximum upload size exceeded

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57438

Martin Visser <ma...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Inifinite redirect loop     |Infinite redirect loop when
                   |when maximum upload size    |maximum upload size
                   |exceeded                    |exceeded

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 57438] Infinite redirect loop when maximum upload size exceeded

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57438

Martin Visser <ma...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

--- Comment #2 from Martin Visser <ma...@gmail.com> ---
After changing the implementation in the Spring MVC controllers I managed to
avoid the problem. I was unable to trace the redirects via Wireshark, but I
still think it's something in Tomcat rather than in Spring.
I did nothing in the Spring application, I only switched Tomcat versions.
That's why I created this issue. But nonetheless, it works for me now, so this
issue can be closed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 57438] Infinite redirect loop when maximum upload size exceeded

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57438

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Tomcat will always use a 302 for a redirect.

Spring MVC will always use a 302 unless the application specifically over-rides
it.

I'd recommend checking exactly what is on the wire with something like
wireshark (you should see 302 redirects rather than 307) and then take a closer
look at your client and/or your app to see why the POST is being resent.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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