iTP Secure WebServer System Administrator's Guide (iTPWebSvr 6.0+)
Using Common Gateway Interface (CGI) Programs
iTP Secure WebServer System Administrator’s Guide—523346-002
8-4
Pathway CGI Server Classes
Pathway CGI Server Classes
Pathway CGI server classes provides substantial improvement in performance by
comparison with conventional or generic-CGI, because the CGI program is
implemented not as a separate process, but as a user-written CGI_main procedure
within a NonStop TS/MP server process.
To create a Pathway CGI server class, you use the CGI library, as follows:
•
Use the following library routines, rather than the corresponding C library routines,
for access to the standard input, output, and error files:
°
CGI_fread
°
CGI_fwrite
°
CGI_printf
°
CGI_getc
°
CGI_puts
•
Use other CGI procedures as required by your application. Table 8-6 on page 8-31
lists and describes all the procedures in the CGI library.
The semantics of CGI routines are identical to the corresponding routines in the
standard C library.
•
Link your application code with the CGI library, libcgi.a, to create an executable
program.
The CGI library uses the context-sensitive Pathsend interface, as shown in Figure 8-3.
The Pathway CGI interface simulates the behavior of the OSS standard input, output,
and error files.
Caution. If your program must read environment variables, write a CGI_initialize routine so
that when CGI_main is invoked, the getenv() call will return the WebServer’s environment
variables. See Design Guidelines
on page 8-34 for more information.
Note. Applications built using a version of libcgi.a that is newer than the version of the iTP
Secure WebServer (httpd process) might not run correctly in the older WebServer
environment. Applications built with a previous version of libcgi.a run correctly with newer
versions of the iTP Secure WebServer.
Note. CGI requests and replies can be of any length. For long requests and replies, the httpd
process and the process labeled “Pathway CGI main” exchange multiple Serverclass_send
and reply messages.