A patch for the above is below. This patch addresses the issues raised by the
second test case attached to the bug report. The first test case was fixed
previously and the third test case works correctly with the current source.
I have checked the TC4 and TC5 code against the TC3 code (where the problem
does not occur) and it looks like the getPathInfo() call has been missed out. I
have also checked the specs and I can't see any reason why the implementation
should have changed. I also took the opportunity to remove some unused imports.
Mark
Index: catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catali
na/core/ApplicationHttpRequest.java,v
retrieving revision 1.11
diff -u -r1.11 ApplicationHttpRequest.java
--- catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java 5
Aug 2003 13:22:03 -0000 1.11
+++ catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java 31
Aug 2003 18:02:06 -0000
@@ -70,7 +70,6 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.Set;
import java.util.Map;
import javax.servlet.RequestDispatcher;
@@ -80,7 +79,6 @@
import org.apache.catalina.Context;
import org.apache.catalina.Globals;
-import org.apache.catalina.HttpRequest;
import org.apache.catalina.Session;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.RequestUtil;
@@ -343,13 +341,23 @@
if (servletPath == null)
servletPath = getServletPath();
- int pos = servletPath.lastIndexOf('/');
+ // Add the path info, if there is any
+ String pathInfo = getPathInfo();
+ String requestPath = null;
+
+ if (pathInfo == null) {
+ requestPath = servletPath;
+ } else {
+ requestPath = servletPath + pathInfo;
+ }
+
+ int pos = requestPath.lastIndexOf('/');
String relative = null;
if (pos >= 0) {
relative = RequestUtil.normalize
- (servletPath.substring(0, pos + 1) + path);
+ (requestPath.substring(0, pos + 1) + path);
} else {
- relative = RequestUtil.normalize(servletPath + path);
+ relative = RequestUtil.normalize(requestPath + path);
}
return (context.getServletContext().getRequestDispatcher(relative));
Index: catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote
/tomcat5/CoyoteRequest.java,v
retrieving revision 1.14
diff -u -r1.14 CoyoteRequest.java
--- catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java 29 Aug 2003
17:18:14 -0000 1.14
+++ catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java 31 Aug 2003
18:01:10 -0000
@@ -66,17 +66,14 @@
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.Socket;
import java.security.Principal;
-import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
@@ -89,11 +86,8 @@
import javax.servlet.FilterChain;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletRequest;
-import javax.servlet.ServletRequestEvent;
-import javax.servlet.ServletRequestListener;
import javax.servlet.ServletRequestAttributeEvent;
import javax.servlet.ServletRequestAttributeListener;
import javax.servlet.http.Cookie;
@@ -106,7 +100,6 @@
import org.apache.tomcat.util.http.FastHttpDateFormat;
import org.apache.tomcat.util.http.Parameters;
import org.apache.tomcat.util.http.mapper.MappingData;
-import org.apache.tomcat.util.net.SSLSupport;
import org.apache.coyote.ActionCode;
import org.apache.coyote.Request;
@@ -1307,13 +1300,23 @@
if (servletPath == null)
servletPath = getServletPath();
- int pos = servletPath.lastIndexOf('/');
+ // Add the path info, if there is any
+ String pathInfo = getPathInfo();
+ String requestPath = null;
+
+ if (pathInfo == null) {
+ requestPath = servletPath;
+ } else {
+ requestPath = servletPath + pathInfo;
+ }
+
+ int pos = requestPath.lastIndexOf('/');
String relative = null;
if (pos >= 0) {
relative = RequestUtil.normalize
- (servletPath.substring(0, pos + 1) + path);
+ (requestPath.substring(0, pos + 1) + path);
} else {
- relative = RequestUtil.normalize(servletPath + path);
+ relative = RequestUtil.normalize(requestPath + path);
}
return (context.getServletContext().getRequestDispatcher(relative));
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]