Bug 42673 - SSI virtual include broken for context path with slashes
Summary: SSI virtual include broken for context path with slashes
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: Other other
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Keywords: PatchAvailable
Depends on:
Reported: 2007-06-15 05:08 UTC by Peter Jodeleit
Modified: 2008-11-30 15:44 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Peter Jodeleit 2007-06-15 05:08:34 UTC
If the context path of an application contains slashes (e.g. "a/b") the method
getPathWithoutContext of class
org.apache.catalina.ssi.SSIServletExternalResolver simply cuts from the second
slash, so for url "/a/b/do?.." it tries to include "b/do?.." instead of "do?..".

The patch is to include the context path and strip the path off:

Line 419
String noContext = getPathWithoutContext(normContext.getContextPath(), normalized);

Line 356ff
protected String getPathWithoutContext(final String contextPath, final String
servletPath) {
   if (servletPath.startsWith(contextPath)) {
      return servletPath.substring(contextPath.length());
    return servletPath;
Comment 1 Mark Thomas 2008-11-08 17:38:31 UTC
Thanks for the patch. It has been applied to trunk and proposed for 6.0.x.
Comment 2 Mark Thomas 2008-11-30 15:44:08 UTC
This has been fixed in 6.0.x and will be included in 6.0.19 onwards. Thanks again for the patch.