18 CGI Scripts
module provides tools
for scripts that follow the Common Gateway Interface [CGI
The net/cgi library expects to be run in a certain
context as defined by the CGI standard. This means, for instance,
that certain environment variables will be bound.
Unfortunately, not all CGI environments provide this. For instance,
the FastCGI library, despite its name, does not bind the environment
variables required of the standard. Users of FastCGI will need to
bind REQUEST_METHOD and possibly also QUERY_STRING
to successfully employ the CGI library. The FastCGI library ought to
provide a way to extract the values bound to these variables; the user
can then put these into the CGI program’s environment using the
A CGI binding is an association of a form item with its
value. Some form items, such as checkboxes, may correspond to
multiple bindings. A binding is a tag-string pair, where a tag is a
symbol or a string.
18.1 CGI Functions
Returns the bindings that corresponding to the options specified by
the user. The get-bindings/post
variants work only when POST and GET forms
are used, respectively, while get-bindings
kind of form that was used and invokes the appropriate function.
These functions respect current-alist-separator-mode.
Given a key and a set of bindings, determines which ones correspond to
a given key. There may be zero, one, or many associations for a given
Outputs an response: a title and a list of strings for the body.
The last five arguments are each strings representing a HTML color; in
order, they represent the color of the text, the background,
un-visited links, visited links, and a link being selected.
Converts a string into an HTML string by applying the appropriate HTML
Takes a string representing a URL, a HTML string for the anchor
text, and generates HTML corresponding to an anchor.
The procedure takes a list of HTML strings representing the body,
prints them with the subject line "Internal error", and exits via
Returns either "GET" or "POST" when invoked inside a
CGI script, unpredictable otherwise.
Converts a set of bindings into a list of HTML strings, which is
useful for debugging.
A supertype for all exceptions thrown by the net/cgi
Raised when a % in a query is followed by an incomplete
suffix. The characters of the suffix – excluding the
% – are provided by the exception.
Raised when the character immediately following a % in a
query is invalid.
18.2 CGI Unit
Imports nothing, exports cgi^
18.3 CGI Signature
Includes everything exported by the net/cgi module.