iTP Secure WebServer System Administrator's Guide (Version 7.0)

iTP Secure WebServer System Administrator’s Guide523346-012
8-1
8
Using Common Gateway Interface
(CGI) Programs
This section introduces you to using Common Gateway Interface (CGI) programs with
the iTP Secure WebServer. Topics discussed in this section include:
CGI Support in the iTP Secure WebServer Environment on page 8-2
CGI Configuration and Programming on page 8-5
Configuring for CGI Programs on page 8-6
Passing CGI Environment Variables on page 8-11
HTTP Header Variables on page 8-21
Passing Input on page 8-23
Returning Output on page 8-26
Logging Error Information on page 8-29
CGI Standard File Environment on page 8-29
CGI Library on page 8-30
Pathway CGI Coding Considerations on page 8-32
Examples of a Pathway CGI Implementation on page 8-34
Web servers use CGI programs to interpret and process the information they receive
from clients. CGI programs also interact with other programs and resources. For
example, if a Web client wants to search a database, a CGI program would receive the
search criteria (for example, keywords) from the Web client as input and would then
interact with the proper search mechanism to gather the information desired. The CGI
program then would process this information for passing back to the Web client
through the server.
CGI programs can be written in several languages; the languages most often used are:
Tcl, shell scripts (Korn or Bourne shell), C, and COBOL. Of these, HP offers C, C++,
and Korn shell (through OSS) as supported products. The iTP Secure WebServer also
enables you to use Java servlets in a CGI execution environment.
When a server receives a request from a Web client, the server runs the CGI program
to process the request and uses either environment variables or standard input to pass
request data to the program. The data passes to the CGI program through the
Common Gateway Interface. After processing the request data, the CGI program uses
standard output to pass requested objects or data to the server, which, in turn, passes
the output to the Web client. Figure 8-1 shows the relationships among the Web client,
a Web server, the CGI, and a CGI program.