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:55:09 UTC

svn commit: r505743 - in /tomcat/tc6.0.x/trunk: java/org/apache/catalina/servlets/CGIServlet.java webapps/docs/changelog.xml

Author: markt
Date: Sat Feb 10 10:55:08 2007
New Revision: 505743

URL: http://svn.apache.org/viewvc?view=rev&rev=505743
Log:
Port SCRIPT_NAME fix

Modified:
    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/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?view=diff&rev=505743&r1=505742&r2=505743
==============================================================================
--- 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 Sat Feb 10 10:55:08 2007
@@ -884,7 +884,7 @@
             String path = null;
             String name = null;
             String scriptname = null;
-            String cginame = null;
+            String cginame = "";
 
             if ((webAppRootDir != null)
                 && (webAppRootDir.lastIndexOf(File.separator) ==
@@ -913,8 +913,9 @@
                 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 };
@@ -924,13 +925,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/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?view=diff&rev=505743&r1=505742&r2=505743
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Sat Feb 10 10:55:08 2007
@@ -14,6 +14,15 @@
   </properties>
 
 <body>
+<section name="Tomcat 6.0.10 (remm)">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        Fix formatting of CGI variable SCRIPT_NAME. (markt)
+      </fix>
+    </changelog>
+  </subsection>
+</section>
 <section name="Tomcat 6.0.9 (remm)">
   <subsection name="General">
     <changelog>



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