httpd::cgi(n) 1.1 "Tcl Web Server"

Name

httpd::cgi - CGI handling

Table Of Contents

Synopsis

Description

The package httpd::cgi provides generic facilities for the implementation of application cgi domains. These are domains where each url in the domain is handled by its own tcl command. Urls for which there is no command to handle it do not exists and cause the generation of an http error reply.

Note: This package also provides a number of type-specific doc handlers which will be picked up and used automatically by package httpd::doc. This will work if and only if an appropriate file extension to mime type mapping was added to httpd::mtype during startup of the server. If a file "mime.types" is present in the server library directory (residence of all packages) it will be read automatically and used to set up a standard mapping to support the type specific handlers exported by this package.

Public API

Cgi_Directory virtual ?directory?

Registers the url prefix virtual as domain for the handling of cgi requests. The given directory is registered as a root in the doc domain. If it is not specified then its name will be derived directly from the url prefix virtual.

The basic standard initialization of the tclhttpd server will register the url prefix "/cgi-bin/".

Cgi_Domain prefix directory sock suffix

The domain handler command. It is public only because of the fallback scheme in the module doc, which calls it directly in some situations.

Doc_application/x-cgi path suffix sock

This command is a type-specific document handler and is called by the package httpd::doc if there is no extra pathname after the name of a cgi script, and the module did find a ".cgi" file.

Cgi_SetEnv sock path ?var?

This command sets up the environment variables for the CGI applications. They are passed implicitly to the applications during the open call which spawns them as separate process.

The request handle is on the connection sock. If var is not specified then the command will manipulate the variable env, else it will work with the specified variable. It assumes that the variable is in the callers scope.

Cgi_SetEnvInterp sock path interp

Like Cgi_SetEnv, but modifies the global variable env in the specified slave interpreter interp.

Cgi_SetEnvAll sock path extra url var

The worker command for both Cgi_SetEnv and Cgi_SetEnvInterp.

Cgi_Ident state

Enables or disables IDENT lookup, according to the value of the boolean flag state. Initially IDENT lookup is off.

See Also

httpd, httpd::counter, httpd::doc, httpd::doc_error, httpd::log, httpd::threadmgr, httpd::url

Keywords

cgi, web server