Using an SSI directive to include a cgi script works under Apache but
fails under Tomcat because the query arguments are not being handled the
same way.  Under Tomcat 5.5.4, the query args are being searched for as
if they were part of the filename. [I made a previous post on this
subject but was then reporting the behavior under Tomcat 4.0.24, which
also fails, but somewhat differently.]

More details are below.  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).  --Brian

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.  [Note: by the default
configuration, /cgi-bin/ is "rewritten" as WEB-INF/cgi/ when the cgi jar
actually searches for the script, so both paths appear in the
log/backtrace below.]

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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to