tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Hill <brianh...@speakeasy.net>
Subject ssi including a cgi with query args is broken --- same combo works under Apache
Date Fri, 10 Dec 2004 19:41:24 GMT
Our site uses an SSI directive to include a cgi script.  This works 
under Apache but fails under Tomcat because the query arguments are not 
being handled the same way.  Under Tomcat 5.5.4, they are being searched 
for as part of the filename.  (The failure mode was different under 
Tomcat 4.0.  Under 4.0, the query args got stripped off, but not put 
into the cgi script's environment.)

Thanks for looking into this, and if for some reason you don't think it 
is worth fixing, any suggestions on a workaround.

Also, I would be happy to test a patch class (I'd need directions for 
where to put the patch class and how to configure the class loader to 
find it).

More details are below.  --Brian

brianhill
at
speakeasy
dot
net

In this log/backtrace, you can see that the CGI jar is trying to find 
the file:

navTool.pl?REF+GENERAL+WHATIS

This file doesn't exist.  On our systems, navTool.pl exists and is in 
WEB-INF/cgi/, and is expecting some query args.

Dec 9, 2004 3:46:04 PM org.apache.catalina.core.ApplicationContext log
INFO: cgi: findCGI: path=/Docs/ref_general1.html,  
/Library/Tomcat/webapps/PCW/WEB-INF/cgi
Dec 9, 2004 3:46:04 PM org.apache.catalina.core.ApplicationContext log
INFO: cgi: findCGI: currentLoc=/Library/Tomcat/webapps/PCW/WEB-INF/cgi
Dec 9, 2004 3:46:04 PM org.apache.catalina.core.ApplicationContext log
INFO: cgi: findCGI: currentLoc=/Library/Tomcat/webapps/PCW/WEB-INF/cgi
Dec 9, 2004 3:46:04 PM org.apache.catalina.core.ApplicationContext log
INFO: cgi: findCGI:  
currentLoc=/Library/Tomcat/webapps/PCW/WEB-INF/cgi/Docs
Dec 9, 2004 3:46:04 PM org.apache.catalina.core.ApplicationContext log
SEVERE: ssi: #include--Couldn't include file: 
/cgi-bin/navTool.pl?REF+GENERAL+WHATIS
java.io.IOException: Couldn't find file: 
/cgi-bin/navTool.pl?REF+GENERAL+WHATIS
        at  
org.apache.catalina.ssi.SSIServletExternalResolver.getFileText(SSIServletExternalResolver.java:391)


        at  
org.apache.catalina.ssi.SSIMediator.getFileText(SSIMediator.java:154)
        at  org.apache.catalina.ssi.SSIInclude.process(SSIInclude.java:40)
        at  
org.apache.catalina.ssi.SSIProcessor.process(SSIProcessor.java:145)
        at  
org.apache.catalina.ssi.SSIServlet.processSSI(SSIServlet.java:193)
        at  
org.apache.catalina.ssi.SSIServlet.requestHandler(SSIServlet.java:170)
        at org.apache.catalina.ssi.SSIServlet.doGet(SSIServlet.java:106)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)


        at  
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)


        at  
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) 

        at  
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) 

        at  
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) 

        at  
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) 

        at  
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) 

        at  
org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve.java:150) 

        at  
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at  
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
        at  
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:383)
        at  
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
        at  
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675) 

        at  
org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
        at  
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) 

        at java.lang.Thread.run(Thread.java:552)

To reproduce this problem, all you need is a web app with a .shtml file 
containing the line

<!-- #include virtual="/cgi-bin/echoargs.pl?some_args" -->

and a perl script WEB-INF/cgi/echoargs.pl containing the lines:

#!/usr/bin/perl -w
my $query_args = $ENV{QUERY_STRING};
if (defined($query_args)) {
    print "query string is<br>\n";
    print "$query_args<br>\n";
} else {
    print "query string is undefined<br>\n";
}


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


Mime
View raw message