Bug 42673

Summary: SSI virtual include broken for context path with slashes
Product: Tomcat 6 Reporter: Peter Jodeleit <pjodeleit>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal Keywords: PatchAvailable
Priority: P2    
Version: unspecified   
Target Milestone: default   
Hardware: Other   
OS: other   

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.