You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2007/02/10 19:45:25 UTC

svn commit: r505740 - in /tomcat/container/tc5.5.x: catalina/src/share/org/apache/catalina/servlets/CGIServlet.java webapps/docs/changelog.xml

Author: markt
Date: Sat Feb 10 10:45:24 2007
New Revision: 505740

URL: http://svn.apache.org/viewvc?view=rev&rev=505740
Log:
Fix problem with CGI variable SCRIPT_NAME reported on users list

Modified:
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java?view=diff&rev=505740&r1=505739&r2=505740
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java (original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/servlets/CGIServlet.java Sat Feb 10 10:45:24 2007
@@ -897,7 +897,7 @@
             String path = null;
             String name = null;
             String scriptname = null;
-            String cginame = null;
+            String cginame = "";
 
             if ((webAppRootDir != null)
                 && (webAppRootDir.lastIndexOf(File.separator) ==
@@ -926,8 +926,10 @@
                 if (debug >= 3) {
                     log("findCGI: currentLoc=" + currentLocation);
                 }
-                currentLocation = new File(currentLocation,
-                                           (String) dirWalker.nextElement());
+                String nextElement = (String) dirWalker.nextElement();
+                currentLocation = new File(currentLocation, nextElement);
+                cginame = cginame + "/" + nextElement;
+                
             }
             if (!currentLocation.isFile()) {
                 return new String[] { null, null, null, null };
@@ -937,13 +939,14 @@
                 }
                 path = currentLocation.getAbsolutePath();
                 name = currentLocation.getName();
-                cginame = (currentLocation.getParent() + File.separator).
-                        substring(webAppRootDir.length()) + name;
 
                 if (".".equals(contextPath)) {
-                    scriptname = servletPath + cginame;
+                    scriptname = servletPath;
                 } else {
-                    scriptname = contextPath + servletPath + cginame;
+                    scriptname = contextPath + servletPath;
+                }
+                if (!servletPath.equals(cginame)) {
+                    scriptname = scriptname + cginame;
                 }
             }
 

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?view=diff&rev=505740&r1=505739&r2=505740
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Sat Feb 10 10:45:24 2007
@@ -182,6 +182,9 @@
         Make provided instances of RequestDispatcher thread safe. (markt)
       </fix>
       <fix>
+        Fix formatting of CGI variab;e SCRIPT_NAME. (markt)
+      </fix>
+      <fix>
         <bug>34643</bug>: Improved documentation for per-user / per-session clientAuth
         usage in SSL Authenticator.  Docs provided by jack and Ralf Hauser.  (yoavs)
       </fix>



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