Home | Trees | Index | Help |
---|
Module SimpleHTTPServer :: Class SimpleHTTPRequestHandler |
|
BaseRequestHandler
--+ |StreamRequestHandler
--+ |BaseHTTPRequestHandler
--+ | SimpleHTTPRequestHandler
CGIHTTPRequestHandler
,
SimpleHTTPRequestHandler
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.Method Summary | |
---|---|
Copy all data between two file objects. | |
Serve a GET request. | |
Serve a HEAD request. | |
Guess the type of a file. | |
Helper to produce a directory listing (absent index.html). | |
Common code for GET and HEAD commands. | |
Translate a /-separated PATH to the local filename syntax. | |
Inherited from BaseHTTPRequestHandler | |
Return the client address formatted for logging. | |
Return the current date and time formatted for a message header. | |
Send the blank line ending the MIME headers. | |
Handle multiple requests if necessary. | |
Handle a single HTTP request. | |
Return the current time formatted for logging. | |
Log an error. | |
Log an arbitrary message. | |
Log an accepted request. | |
Parse a request (internal). | |
Send and log an error reply. | |
Send a MIME header. | |
Send the response header and log the response code. | |
Return the server software version string. | |
Inherited from StreamRequestHandler | |
| |
| |
Inherited from BaseRequestHandler | |
|
Class Variable Summary | |
---|---|
dict |
extensions_map = {'': 'application/octet-stream', '.obj'...
|
str |
server_version = 'SimpleHTTP/0.6'
|
Inherited from BaseHTTPRequestHandler | |
str |
error_message_format = '<head>\n<title>Error response</t...
|
list |
monthname = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'J...
|
str |
protocol_version = 'HTTP/1.0'
|
dict |
responses = {400: ('Bad request', 'Bad request syntax or...
|
str |
sys_version = 'Python/2.3.4'
|
list |
weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',...
|
Inherited from StreamRequestHandler | |
int |
rbufsize = -1 |
int |
wbufsize = 0 |
Method Details |
---|
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. |
do_GET(self)Serve a GET request. |
do_HEAD(self)Serve a HEAD request. |
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. |
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(). |
send_head(self)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. |
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.) |
Class Variable Details |
---|
server_version
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Mon Aug 02 01:07:41 2004 | http://epydoc.sf.net |