||Simple HTTP request handler with GET and HEAD commands.|
This serves files from the current directory and any of its
subdirectories. It assumes that all files are plain text files
unless they have the extension ".html" in which case it assumes
they are HTML files.
The GET and HEAD requests are identical except that the HEAD
request omits the actual contents of the file.
- __del__(self) from SocketServer.BaseRequestHandler
- __init__(self, request, client_address, server) from SocketServer.BaseRequestHandler
- address_string(self) from BaseHTTPServer.BaseHTTPRequestHandler
- copyfile(self, source, outputfile)
- Copy all data between two file objects.
The SOURCE argument is a file object open for reading
(or anything with a read() method) and the DESTINATION
argument is a file object open for writing (or
anything with a write() method).
The only reason for overriding this would be to change
the block size or perhaps to replace newlines by CRLF
-- note however that this the default server uses this
to copy binary data as well.
- date_time_string(self) from BaseHTTPServer.BaseHTTPRequestHandler
- Serve a GET request.
- Serve a HEAD request.
- end_headers(self) from BaseHTTPServer.BaseHTTPRequestHandler
- finish(self) from SocketServer.StreamRequestHandler
- guess_type(self, path)
- Guess the type of a file.
Argument is a PATH (a filename).
Return value is a string of the form type/subtype,
usable for a MIME Content-type header.
The default implementation looks the file's extension
up in the table self.extensions_map, using text/plain
as a default; however it would be permissible (if
slow) to look inside the data to make a better guess.
- handle(self) from BaseHTTPServer.BaseHTTPRequestHandler
- list_directory(self, path)
- Helper to produce a directory listing (absent index.html).
Return value is either a file object, or None (indicating an
error). In either case, the headers are sent, making the
interface the same as for send_head().
- log_date_time_string(self) from BaseHTTPServer.BaseHTTPRequestHandler
- log_error(self, *args) from BaseHTTPServer.BaseHTTPRequestHandler
- log_message(self, format, *args) from BaseHTTPServer.BaseHTTPRequestHandler
- log_request(self, code='-', size='-') from BaseHTTPServer.BaseHTTPRequestHandler
- parse_request(self) from BaseHTTPServer.BaseHTTPRequestHandler
- send_error(self, code, message=None) from BaseHTTPServer.BaseHTTPRequestHandler
- Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or
None, in which case the caller has nothing further to do.
- send_header(self, keyword, value) from BaseHTTPServer.BaseHTTPRequestHandler
- send_response(self, code, message=None) from BaseHTTPServer.BaseHTTPRequestHandler
- setup(self) from SocketServer.StreamRequestHandler
- translate_path(self, path)
- Translate a /-separated PATH to the local filename syntax.
Components that mean special things to the local file system
(e.g. drive or directory names) are ignored. (XXX They should
probably be diagnosed.)
- version_string(self) from BaseHTTPServer.BaseHTTPRequestHandler