DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4379>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4379 Incorrect content-length header with redirect Summary: Incorrect content-length header with redirect Product: Tomcat 3 Version: 3.2.3 Final Platform: PC OS/Version: Linux Status: NEW Severity: Normal Priority: Other Component: Unknown AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] When a jsp page uses response.sendRedirect(), a default html page is served, which also sets the content length. This length is incorrect as the jsp page can write additional content to the out stream. In fact, it seems always incorrect as jasper adds one out.write("\n"). The incorrect content length causes the greatest problems when used with HTTP/1.1 connections through jserv + Apache, as the extra content arrives where the browser expects another HTTP/1.1 header, and sometimes it displays the extra content, followed by the real second header (the one for the redirect target), followed by the content of the redirect target. This browser behaviour is timing dependant. Even with the local http connector, it seems incorrect behaviour, but doesn't matter as the client closes the socket after reading content-length bytes. To reproduce: -- begin file1.jsp -- <% response.sendRedirect("file2.jsp"); %> <html> <body>This text will be served, but content-length doesn't include it</body> </html> -- end file1.jsp Quick, possibly bad, solution: Remove: res.setContentLength(body.length()); from RedirectHandler.doService() (Line 468 in /share/org/apache/tomcat/context/DefaultCMSetter.java) It should possibly also be removed from NotFoundHandler
