Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359031

Summary: The CGI servlet should support serving scripts from customisable paths within the context
Product: [RT] Jetty Reporter: Florian Hackenberger <f.hackenberger>
Component: otherAssignee: Project Inbox <jetty-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: simone.bordet
Version: unspecified   
Target Milestone: 7.5.x   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Implements the enhancement request
none
proposed patch
none
proposed patch none

Description Florian Hackenberger CLA 2011-09-27 05:40:22 EDT
Build Identifier: 

When setting the cgibinResourceBase init-param, the jetty CGI servlet expects that path to be an absolute or relative path to the current working directory. It would be nice if specifying WEB-INF/cgi for example would work. Tomcat supports that BTW.

Reproducible: Always
Comment 1 Florian Hackenberger CLA 2011-09-27 05:43:50 EDT
Created attachment 204061 [details]
Implements the enhancement request

Setting the following init parameters exposes everthing in WEB-INF/cgi as cgi servlets, accessible using CONTEXTROOT/cgi-bin/CGIFILE.cgi

	<servlet>
		<servlet-name>cgi</servlet-name>
		<servlet-class>org.eclipse.jetty.servlets.CGI</servlet-class>
		<init-param>
			<param-name>cgibinResourceBase</param-name>
			<param-value>WEB-INF/cgi</param-value>
		</init-param>
		<init-param>
			<param-name>cgibinResourceBaseRelative</param-name>
			<param-value>true</param-value>
		</init-param>
	</servlet>
	<servlet-mapping>
		<servlet-name>cgi</servlet-name>
		<url-pattern>/cgi-bin/*</url-pattern>
	</servlet-mapping>
Comment 2 Thomas Becker CLA 2011-10-12 10:57:38 EDT
Created attachment 205042 [details]
proposed patch

I've applied and tested the suggested changes and don't see any side effects. So attached is the git patches.

Thx a lot for the contribution!
Comment 3 Simone Bordet CLA 2011-11-04 11:00:18 EDT
Patch applied.
Comment 4 Florian Hackenberger CLA 2011-11-04 11:18:30 EDT
Thanks for accepting the patch!
Comment 5 Thomas Becker CLA 2011-11-04 14:49:42 EDT
Created attachment 206478 [details]
proposed patch

Javadoc update.

Please not that this will only work on extracted war files as "jar cf" will not presume the execute permissions needed on the cgi files.
Comment 6 Simone Bordet CLA 2011-11-04 15:32:23 EDT
Javadoc patch applied.