Summary: | When requests are forwarded, the request attribute javax.servlet.forward.path_info is assigned an incorrect value. | ||
---|---|---|---|
Product: | Tomcat 7 | Reporter: | diego.rivera.cr <diego.rivera.cr> |
Component: | Servlet & JSP API | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 7.0.23 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux |
Description
diego.rivera.cr@gmail.com
2012-02-02 18:49:59 UTC
The problem seems to be in StandardHostValve, on (or about) line 438: private boolean custom(Request request, Response response, ErrorPage errorPage) { if (container.getLogger().isDebugEnabled()) container.getLogger().debug("Processing " + errorPage); request.setPathInfo(errorPage.getLocation()); try { // Forward control to the specified location ServletContext servletContext = request.getContext().getServletContext(); Here, evidently the pathinfo for the request being serviced is set to the location of the error page being forwarded to: request.setPathInfo(errorPage.getLocation()); This is evidently incorrect: pathInfo should be set to the path info of the topmost request on the stack, not the location of the error page being forwarded to (this explicitly contradicts the Servlet spec). In my mind, this line should simply not exist. I'll leave it up to you Tomcat experts to determine what the impact of that is. The second time this evening I have had to dig back more than 5 years into the svn history to figure out why some code is the way it is. It must be code archaeology week and but no-one bothered to tell me. That line was added in r301993 which was a modification to 301883 which was an ugly hack to fix bug 20018. With the current Tomcat code, there is no need for the hack (I didn't dig into when the hack became unnecessary) so the line can be removed. For the record, only the path info was affected and then, only during error handling. This has been fixed in trunk and 7.0.x and will be included in 7.0.26 onwards. |