You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Kelly, Steve" <St...@commercequest.com> on 2005/02/18 20:06:37 UTC
CGI
Hi,
Is the following consistent with how CGI perl scripts should execute
under a tomcat webapp?
I have a webapp called mywebapp and a perl script called myperl
The web.xml file contains the following:
<servlet>
<servlet-name>cgi</servlet-name>
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
<init-param>
<param-name>clientInputTimeout</param-name>
<param-value>100</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>6</param-value>
</init-param>
<init-param>
<param-name>executable</param-name>
<param-value>perl</param-value>
</init-param>
<init-param>
<param-name>cgiPathPrefix</param-name>
<param-value>WEB-INF/cgi</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
and
<servlet-mapping>
<servlet-name>cgi</servlet-name>
<url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>
If I enter the url //localhost:8080/mywebapp/WEB-INF/cgi/myperl I get a
"resource unavailable" error.
If I enter the url //localhost:8080/mywebapp/cgi-bin/myperl it executes
the myperl script successsfully.
If I edit the web.xml file to change the cgiPathPrefix to, for example,
myscripts/cgi and then
I enter the url //localhost:8080/mywebapp/myscripts/cgi/myperl it simply
displays the perl script code.
Again if I enter the url //localhost:8080/mywebapp/cgi-bin/myperl it
executes the myperl script successsfully.
TIA
Steve.
Re: CGI
Posted by Mark Thomas <ma...@apache.org>.
Kelly, Steve wrote:
> Hi,
>
> Is the following consistent with how CGI perl scripts should execute
> under a tomcat webapp?
>
> I have a webapp called mywebapp and a perl script called myperl
> The web.xml file contains the following:
>
> <servlet>
> <servlet-name>cgi</servlet-name>
>
> <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
> <init-param>
> <param-name>clientInputTimeout</param-name>
> <param-value>100</param-value>
> </init-param>
> <init-param>
> <param-name>debug</param-name>
> <param-value>6</param-value>
> </init-param>
> <init-param>
> <param-name>executable</param-name>
> <param-value>perl</param-value>
> </init-param>
> <init-param>
> <param-name>cgiPathPrefix</param-name>
> <param-value>WEB-INF/cgi</param-value>
> </init-param>
> <load-on-startup>5</load-on-startup>
> </servlet>
>
> and
>
> <servlet-mapping>
> <servlet-name>cgi</servlet-name>
> <url-pattern>/cgi-bin/*</url-pattern>
> </servlet-mapping>
>
> If I enter the url //localhost:8080/mywebapp/WEB-INF/cgi/myperl I get a
> "resource unavailable" error.
Correct. Resources under WEB-INF are not directly accessible.
> If I enter the url //localhost:8080/mywebapp/cgi-bin/myperl it executes
> the myperl script successsfully.
Also correct.
>
> If I edit the web.xml file to change the cgiPathPrefix to, for example,
> myscripts/cgi and then
> I enter the url //localhost:8080/mywebapp/myscripts/cgi/myperl it simply
> displays the perl script code.
This is as expected for the configuration settings. However, I wouldn't
want to run my server like this. It is usually a bad thing (tm) from a
security point of view to expose your CGI script.
> Again if I enter the url //localhost:8080/mywebapp/cgi-bin/myperl it
> executes the myperl script successsfully.
Also, as expected from the config settings.
HTH,
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org