tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r595802 - /tomcat/trunk/java/org/apache/catalina/servlets/CGIServlet.java
Date Fri, 16 Nov 2007 20:07:22 GMT
Author: markt
Date: Fri Nov 16 12:07:21 2007
New Revision: 595802

URL: http://svn.apache.org/viewvc?rev=595802&view=rev
Log:
Include CGI include fix in trunk

Modified:
    tomcat/trunk/java/org/apache/catalina/servlets/CGIServlet.java

Modified: tomcat/trunk/java/org/apache/catalina/servlets/CGIServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/CGIServlet.java?rev=595802&r1=595801&r2=595802&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/servlets/CGIServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/servlets/CGIServlet.java Fri Nov 16 12:07:21 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() ) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message