Uploaded image for project: 'JBoss Web Server'
  1. JBoss Web Server
  2. JWS-485

Windows Tomcat7 CGI script execution throws syntax error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • JWS 3.0.3 CR1.1
    • tomcat7
    • None
    • Windows

    • Hide

      1) Prepare script in webapps directory

      echo Content-type: text/html
      echo.
      echo HTTP_PROXY [%HTTP_PROXY%]
      

      2) Configure web.xml

      	<servlet>
      		<servlet-name>cgi</servlet-name>
      		<servlet-class&gt;org.apache.catalina.servlets.CGIServlet</servlet-class&gt;
      		<init-param>
      			<param-name>debug</param-name>
      			<param-value>6</param-value>
      		</init-param>
      		<init-param>
      			<param-name>cgiPathPrefix</param-name>
      			<param-value>WEB-INF/cgi</param-value>
      		</init-param>
      		<init-param>
      			<param-name>passShellEnvironment</param-name>
      			<param-value>true</param-value>
      		</init-param>
      		<load-on-startup>5</load-on-startup>
      	</servlet>
      
      	<servlet-mapping>
      		<servlet-name>cgi</servlet-name>
      		<url-pattern>/cgi-bin/*</url-pattern>
      	</servlet-mapping>
      

      3) Configure context.xml with

      <Context privileged="true">
      

      4) Reach script with a client .../cgi-bin/echo.bat (response is 200, but nothing is echoed)
      5) Log localhost.log contains:

      INFO: cgi: runCGI (stderr):syntax error at C:\Program Files\jws-3.0\share\tomcat7\webapps\2016-5388\WEB-INF\cgi\echo.bat line 1, near "type:"
      Aug 04, 2016 7:36:43 AM org.apache.catalina.core.ApplicationContext log
      INFO: cgi: runCGI (stderr):Execution of C:\Program Files\jws-3.0\share\tomcat7\webapps\2016-5388\WEB-INF\cgi\echo.bat aborted due to compilation errors.
      
      Show
      1) Prepare script in webapps directory echo Content-type: text/html echo. echo HTTP_PROXY [%HTTP_PROXY%] 2) Configure web.xml <servlet> <servlet-name>cgi</servlet-name> <servlet- class& gt;org.apache.catalina.servlets.CGIServlet</servlet- class& gt; <init-param> <param-name>debug</param-name> <param-value>6</param-value> </init-param> <init-param> <param-name>cgiPathPrefix</param-name> <param-value>WEB-INF/cgi</param-value> </init-param> <init-param> <param-name>passShellEnvironment</param-name> <param-value> true </param-value> </init-param> <load-on-startup>5</load-on-startup> </servlet> <servlet-mapping> <servlet-name>cgi</servlet-name> <url-pattern>/cgi-bin/*</url-pattern> </servlet-mapping> 3) Configure context.xml with <Context privileged= " true " > 4) Reach script with a client .../cgi-bin/echo.bat (response is 200, but nothing is echoed) 5) Log localhost.log contains: INFO: cgi: runCGI (stderr):syntax error at C:\Program Files\jws-3.0\share\tomcat7\webapps\2016-5388\WEB-INF\cgi\echo.bat line 1, near "type:" Aug 04, 2016 7:36:43 AM org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr):Execution of C:\Program Files\jws-3.0\share\tomcat7\webapps\2016-5388\WEB-INF\cgi\echo.bat aborted due to compilation errors.

      When trying access CGI script (which can be run standalone correctly):

      echo Content-type: text/html
      echo.
      echo HTTP_PROXY [%HTTP_PROXY%]
      

      on windows configured for tomcat7 the error:

      INFO: cgi: runCGI (stderr):syntax error at C:\Program Files\jws-3.0\share\tomcat7\webapps\2016-5388\WEB-INF\cgi\echo.bat line 1, near "type:"
      Aug 04, 2016 7:36:43 AM org.apache.catalina.core.ApplicationContext log
      INFO: cgi: runCGI (stderr):Execution of C:\Program Files\jws-3.0\share\tomcat7\webapps\2016-5388\WEB-INF\cgi\echo.bat aborted due to compilation errors.
      

      appears.

              rhn-support-csutherl Coty Sutherland
              fgoldefu@redhat.com Filip Goldefus (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: