From: markt Date: Fri, 16 Nov 2007 20:07:21 +0000 (+0000) Subject: Include CGI include fix in trunk X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0651a444d9f879256aa763568064002bafb31c3d;p=tomcat7.0 Include CGI include fix in trunk git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@595802 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/servlets/CGIServlet.java b/java/org/apache/catalina/servlets/CGIServlet.java index 586d9207f..d7588d6cf 100644 --- a/java/org/apache/catalina/servlets/CGIServlet.java +++ b/java/org/apache/catalina/servlets/CGIServlet.java @@ -784,16 +784,31 @@ public final class CGIServlet extends HttpServlet { */ 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 @@ public final class CGIServlet extends HttpServlet { 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() ) {