You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/05/16 23:51:42 UTC

DO NOT REPLY [Bug 19998] New: - CGIServlet doesn't resolve PATH_INFO correctly

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19998>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19998

CGIServlet doesn't resolve PATH_INFO correctly

           Summary: CGIServlet doesn't resolve PATH_INFO correctly
           Product: Tomcat 4
           Version: 4.1.24
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Servlets:CGI
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: jim.clark@idea.com


According to the CGIServlet JavaDocs, the following url:
   http://localhost:8080/<web-app>/cgi-bin/dir1/script/pathinfo1 
Should set the PATH_INFO env. var to "/pathinfo1".  

However, this does not occur. Instead, it results in the error page displaying 
path_info as "/script/pathinfo1".

The problem, I believe, is in the findCGI method of the CGIServlet and 
tokenization of the url:
            new StringTokenizer(pathInfo, File.separator);

On my platform, File.separator = "\".  If you change the code to:
            new StringTokenizer(pathInfo, "/");  //forward slash
the path_info is resolved correctly.

Jim

-------------------------------------------------------------
I set up a simple perl script to dump the env. vars:
#!d:\Perl\bin\perl.exe
print 
   "Content-type: text/plain\n\n";

foreach $var (
   sort keys %ENV) {
   print 
      "$var=\"$ENV{$var}\"\n";
}

@values = split(
   /&/,$ENV{'QUERY_STRING'});
foreach $i (@values) {
   ($varname, $mydata) = split(
      /=/,$i);
   print "$varname = $mydata\n";
}

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