SimpleHTTPServer.SimpleHTTPRequestHandler

class SimpleHTTPServer.SimpleHTTPRequestHandler(request, client_address, server)[source]

Simple HTTP request handler with GET and HEAD commands.

This serves files from the current directory and any of its subdirectories. The MIME type for files is determined by calling the .guess_type() method.

The GET and HEAD requests are identical except that the HEAD request omits the actual contents of the file.

Methods

__init__(request, client_address, server)
address_string() Return the client address formatted for logging.
copyfile(source, outputfile) Copy all data between two file objects.
date_time_string([timestamp]) Return the current date and time formatted for a message header.
do_GET() Serve a GET request.
do_HEAD() Serve a HEAD request.
end_headers() Send the blank line ending the MIME headers.
finish()
guess_type(path) Guess the type of a file.
handle() Handle multiple requests if necessary.
handle_one_request() Handle a single HTTP request.
list_directory(path) Helper to produce a directory listing (absent index.html).
log_date_time_string() Return the current time formatted for logging.
log_error(format, *args) Log an error.
log_message(format, *args) Log an arbitrary message.
log_request([code, size]) Log an accepted request.
parse_request() Parse a request (internal).
send_error(code[, message]) Send and log an error reply.
send_head() Common code for GET and HEAD commands.
send_header(keyword, value) Send a MIME header.
send_response(code[, message]) Send the response header and log the response code.
setup()
translate_path(path) Translate a /-separated PATH to the local filename syntax.
version_string() Return the server software version string.