The SimpleHTTPServer module defines a request-handler class, interface compatible with BaseHTTPServer.BaseHTTPRequestHandler which serves files only from a base directory.
The SimpleHTTPServer module defines the following class:
A lot of the work is done by the base class BaseHTTPServer.BaseHTTPRequestHandler, such as parsing the request. This class implements the do_GET() and do_HEAD() functions.
The SimpleHTTPRequestHandler defines the following member variables:
The SimpleHTTPRequestHandler defines the following methods:
If the request was mapped to a directory, a 403 respond is output, followed by the explanation 'Directory listing not supported'. Any IOError exception in opening the requested file, is mapped to a 404, 'File not found' error. Otherwise, the content type is guessed using the extensions_map variable.
A 'Content-type:' with the guessed content type is output, and then a blank line, signifying end of headers, and then the contents of the file. The file is always opened in binary mode.
For example usage, see the implementation of the test() function.
See Also: