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:
|request, client_address, server)|
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:
"SimpleHTTP/" + __version__, where
__version__is defined in the module.
text/plain. The mapping is used case-insensitively, and so should contain only lower-cased keys.
The SimpleHTTPRequestHandler defines the following methods:
'HEAD'request type: it sends the headers it would send for the equivalent
GETrequest. See the do_GET() method for more complete explanation of the possible headers.
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
'File not found' error. Otherwise, the content
type is guessed using the extensions_map variable.
'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.