Author: markt Date: Fri Nov 16 12:07:07 2007 New Revision: 595801 URL: http://svn.apache.org/viewvc?rev=595801&view=rev Log: Fix CGI failed when included
Modified: tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/CGIServlet.java tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=595801&r1=595800&r2=595801&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Fri Nov 16 12:07:07 2007 @@ -32,11 +32,6 @@ -1: funkman InetAddress.getLocalHost() != localhost - it should be InetAddress.getByName("localhost").getHostAddress() -* Fix bug in CGI servlet that causes it to fail when included - http://people.apache.org/~markt/patches/2007-10-28-cgi-include.patch - +1: markt, remm, fhanik - -1: - * Fix BZ 43702 - Inner class files have unnecessarily long names http://people.apache.org/~markt/patches/2007-10-30-Bug43702.patch +1: markt, remm, fhanik, pero Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/CGIServlet.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/CGIServlet.java?rev=595801&r1=595800&r2=595801&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/CGIServlet.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/CGIServlet.java Fri Nov 16 12:07:07 2007 @@ -784,16 +784,31 @@ */ protected void setupFromRequest(HttpServletRequest req) throws UnsupportedEncodingException { - - this.contextPath = req.getContextPath(); - this.servletPath = req.getServletPath(); - this.pathInfo = req.getPathInfo(); + + boolean isIncluded = false; + + // Look to see if this request is an include + if (req.getAttribute(Globals.INCLUDE_REQUEST_URI_ATTR) != null) { + isIncluded = true; + } + if (isIncluded) { + this.contextPath = (String) req.getAttribute( + Globals.INCLUDE_CONTEXT_PATH_ATTR); + this.servletPath = (String) req.getAttribute( + Globals.INCLUDE_SERVLET_PATH_ATTR); + this.pathInfo = (String) req.getAttribute( + Globals.INCLUDE_PATH_INFO_ATTR); + } else { + this.contextPath = req.getContextPath(); + this.servletPath = req.getServletPath(); + this.pathInfo = req.getPathInfo(); + } // If getPathInfo() returns null, must be using extension mapping // In this case, pathInfo should be same as servletPath if (this.pathInfo == null) { this.pathInfo = this.servletPath; } - + // If the request method is GET, POST or HEAD and the query string // does not contain an unencoded "=" this is an indexed query. // The parsed query string becomes the command line parameters @@ -801,7 +816,13 @@ if (req.getMethod().equals("GET") || req.getMethod().equals("POST") || req.getMethod().equals("HEAD")) { - String qs = req.getQueryString(); + String qs; + if (isIncluded) { + qs = (String) req.getAttribute( + Globals.INCLUDE_QUERY_STRING_ATTR); + } else { + qs = req.getQueryString(); + } if (qs != null && qs.indexOf("=") == -1) { StringTokenizer qsTokens = new StringTokenizer(qs, "+"); while ( qsTokens.hasMoreTokens() ) { Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=595801&r1=595800&r2=595801&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Fri Nov 16 12:07:07 2007 @@ -50,14 +50,17 @@ <subsection name="Catalina"> <changelog> <fix> - <bug>43675</bug>: Fix a possible logging related classloader leak (markt). + <bug>43675</bug>: Fix a possible logging related classloader leak. (markt) + </fix> + <fix> + Fix a bug that causes CGI Servlet to fail when it is included. (markt) </fix> </changelog> </subsection> <subsection name="Jasper"> <changelog> <fix> - <bug>43675</bug>: Fix a possible logging related classloader leak (markt). + <bug>43675</bug>: Fix a possible logging related classloader leak. (markt) </fix> </changelog> </subsection> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]