| Python Library Reference |
TheSimpleHTTPServer module defines a request-handler class,interface compatible withBaseHTTPServer.BaseHTTPRequestHandlerwhich serves files only from a base directory.
TheSimpleHTTPServer module defines the following class:
A lot of the work is done by the base classBaseHTTPServer.BaseHTTPRequestHandler, such as parsing therequest. This class implements thedo_GET() anddo_HEAD() functions.
TheSimpleHTTPRequestHandler defines the following membervariables:
"SimpleHTTP/" + __version__, where__version__is defined in the module.text/plain.The mapping is used case-insensitively, and so should contain onlylower-cased keys.TheSimpleHTTPRequestHandler defines the following methods:
'HEAD' request type: it sends theheaders it would send for the equivalentGET request. See thedo_GET() method for more complete explanation of the possibleheaders.If the request was mapped to a directory, a403 respond is output,followed by the explanation'Directory listing not supported'.AnyIOError exception in opening the requested file, is mappedto a404,'File not found' error. Otherwise, the contenttype is guessed using theextensions_map variable.
A'Content-type:' with the guessed content type is output, andthen a blank line, signifying end of headers, and then the contents ofthe file. The file is always opened in binary mode.
For example usage, see the implementation of thetest()function.
See Also:
| Python Library Reference |