The CGIHTTPServer module defines a request-handler class,
interface compatible with
BaseHTTPServer.BaseHTTPRequestHandler and inherits behavior
from SimpleHTTPServer.SimpleHTTPRequestHandler but can also
run CGI scripts.
This module can run CGI scripts on Unix and Windows systems;
on Mac OS it will only be able to run Python scripts within the same
process as itself.
The CGIHTTPServer module defines the following class:
This class is used to serve either files or output of CGI scripts from
the current directory and below. Note that mapping HTTP hierarchic
structure to local directory structure is exactly as in
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
The CGIHTTPRequestHandler defines the following data member: