
Enterprise Server 6.1 APIs
12 Netscape Enterprise Server Programmer’s Guide • April 2002 (Draft)
CGI
Common Gateway Interface (CGI) programs run on the server and generate a
response to return to the requesting client. CGI programs can be written in various
languages, including C, C++, Java™, Perl™, and as shell scripts. CGI programs are
invoked throughURL invocation.
Enterprise Server complies with the version 1.1 CGI specification.
Sincetheserverstarts upa process each timetheCGIscript or programruns,thisis
an expensive method of programming the server.
Enabling CGI
Enterprise Server provides two ways to identify CGI programs:
• Specifying CGI Directories. The server treats all files in CGI directories as CGI
programs.
• Specifying CGI File Extensions. The server treats all files with the specified
extensions as CGI programs.
Specifying CGI Directories
To specify directories that contain CGI programs (and only CGI programs) use the
CGI Directory page in the Programs tab of the Class Manager. The server treats all
filesinthesedirectoriesasCGIprograms.
For each CGI directory, the file
obj.conf contains a NameTrans directive that
associates the name
cgi with each request for a resource in that directory. These
directives are automatically added to
obj.conf when you specify CGI directories
in the Class Manager interface, or you can manually add them to
obj.conf if
desired.
For example, the following instruction interprets all requests for resources in
http://server-name/cgi-local as requeststoinvokeCGIprogramsinthedirectory
C:/netscape/servers/docs/mycgi.
NameTrans fn="pfx2dir" from="/cgi-local"
dir="C:/netscape/servers/docs/mycgi" name="cgi"
The obj.conf file must contain the following named object:
<Object name="cgi">
ObjectType fn="force-type" type="magnus-internal/cgi"
Service fn="send-cgi"
</Object>
Commentaires sur ces manuels