The CGIHTTPServer module defines a request-handler class, interface compatible with BaseHTTPServer.BaseHTTPRequestHandler and inherits behaviour from SimpleHTTPServer.SimpleHTTPRequestHandler but can also run CGI scripts.
The CGIHTTPServer module defines the following class:
The class will however, run the CGI script, instead of serving it as a file, if it guesses it to be a CGI script. Only directory-based CGI are used -- the other common server configuration is to treat special extensions as denoting CGI scripts.
The do_GET() and do_HEAD() functions are modified to run CGI scripts and serve the output, instead of serving files, if the request leads to somewhere below the cgi_directories path.
The CGIHTTPRequestHandler defines the following data member:
The CGIHTTPRequestHandler defines the following methods:
Note that CGI scripts will be run with UID of user nobody, for security reasons. Problems with the CGI script will be translated to error 403.
For example usage, see the implementation of the test() function.
See Also: