|
|||||||||
|
Executing programs to generate documentsGN allows documents and menus to be generated by external programs. As outlined above, an external program will be invoked for general searching, specified as item type 7. Programs can also be specified by using exec or CGI as the initial part of the Path field. The string exec indicates that the item is generated by an external program. This string is followed by a GN type specifier (see Table for a list of valid types), which indicates the type of document that the program generates, a pair of colons, and the relative pathname of the script. Program arguments may be specified between the colons. Such programs can be called in response to Gopher requests as well as HTTP requests. The following example includes three exec items: the first specifies a program that generates a text file, the second generates a virtual menu and the third an image file:
Name=Display server usage statistics. Path=exec0::/dir/stats-program The initial string CGI in the Path field indicates a program that adheres to the Common Gateway Interface specification (see Section ). Arguments to the program are included in the URL after the part that identifies the program. The program name must end with the suffix .cgi (or an alternative string specified when the server program was compiled), so that the program name part of the URL can be identified. For example:
Name=Sample CGI script. Path=CGI/bin/script.cgi This program could be invoked from a Web browser, passing the string `prog-data' by specifying a URL:
http://www.gnsite.org/CGI/bin/script.cgi/prog-data
Next: GN command line Up: GN cache files Previous: Protocol-dependent menu items
Spinning the Web by Andrew Ford |
||||||
Copyright © 1996-2002 Ford & Mason Ltd |