iTP Secure WebServer System Administrators Guide (Version 7.5+)

7 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” (page 139)
“CGI Configuration and Programming” (page 141)
“Configuring for CGI Programs” (page 142)
“Passing CGI Environment Variables” (page 146)
“HTTP Header Variables” (page 153)
“Passing Input” (page 155)
“Returning Output” (page 156)
“Logging Error Information” (page 158)
“CGIStandard File Environment” (page 159)
“CGI Library” (page 159)
“Pathway CGI Coding Considerations” (page 161)
“Examples of a Pathway CGI Implementation” (page 162)
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 languages, 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. “CGI Relationships (page 139)
displays the relationships among the Web client, a Web server, the CGI, and a CGI program.
138 Using Common Gateway Interface (CGI) Programs