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

Using Common Gateway Interface (CGI) Programs
iTP Secure WebServer System Administrator’s Guide523346-012
8-30
Customizing the Standard File Environment
Customizing the Standard File Environment
You can use the Stdin, Stdout, and Stderr options to the Server directive to
customize the standard file environment for your CGI program.
For a Pathway CGI application, the CGI library procedures always use the httpd
process in place of standard files, but the application can use the corresponding C or
other language library functions (for example, printf) for access to the files specified
by Stdin, Stdout, and Stderr. For example, the SSC uses the standard output and
error files you specify for error reporting.
CGI Library
A CGI program to be invoked by the generic-CGI server class uses standard functions,
such as C library functions, for access to the standard file environment.
A Pathway CGI application uses the CGI library for access to standard files. Table 8-6
lists and describes the procedures in the CGI library.
Table 8-6. CGI Procedures (page 1 of 3)
Procedure Description
CGI_Capture() This procedure decodes the name/value pairs encoded in form
data returned by the POST request method or in the
QUERY_STRING returned by the GET request method, creates
an environment variable for each name/value pair and sets the
value of the variable. CGI_Capture() might be called in lieu of
placing the Region directive AddCGI
AUTOMATIC_FORM_DECODING ON command in the server’s
configuration file.
CGI_feof() This procedure is analogous to the feof() procedure in the C
library: It tests for the end-of-file condition on a specified stream
and returns a nonzero value if it encounters the end-of-file.
CGI_fgets() This procedure is analogous to the fgets() procedure in the C
library. The CGI_fgets() function reads data from the stream
pointed to by the stream parameter into the array pointed to by the
string parameter. Data is read until n-1 bytes have been read, a
newline character is read, or an end-of-file condition is
encountered. The string represented by the data is then
terminated with a NULL character.
CGI_main() This procedure is used as an entry point into a user-written CGI
server class. The CGI environment changes on each invocation of
CGI_main. (See Design Guidelines on page 8-33.)