Module BaseHTTPServer
[hide private]
[frames] | no frames]

Module BaseHTTPServer

HTTP server base class.

Note: the class in this module doesn't implement any HTTP request; see
SimpleHTTPServer for simple implementations of GET, HEAD and POST
(including CGI scripts).  It does, however, optionally implement HTTP/1.1
persistent connections, as of version 0.3.

Contents:

- BaseHTTPRequestHandler: HTTP request handler base class
- test: test function

XXX To do:

- log requests even later (to capture byte count)
- log user-agent header and other interesting goodies
- send error log to separate file


Version: 0.3

Classes [hide private]
HTTPServer
BaseHTTPRequestHandler
HTTP request handler base class.
Functions [hide private]
 
_quote_html(html)
 
test(HandlerClass=<class BaseHTTPServer.BaseHTTPRequestHandler at 0x406f914c>, ServerClass=<class BaseHTTPServer.HTTPServer at 0x406ee8cc>, protocol='HTTP/1.0')
Test the HTTP request handler class.
Variables [hide private]
  DEFAULT_ERROR_MESSAGE = '<head>\n<title>Error response</title>...

Imports: sys, time, socket, mimetools, SocketServer


Function Details [hide private]

test(HandlerClass=<class BaseHTTPServer.BaseHTTPRequestHandler at 0x406f914c>, ServerClass=<class BaseHTTPServer.HTTPServer at 0x406ee8cc>, protocol='HTTP/1.0')

 

Test the HTTP request handler class.

This runs an HTTP server on port 8000 (or the first command line argument).


Variables Details [hide private]

DEFAULT_ERROR_MESSAGE

Value:
'''<head>
<title>Error response</title>
</head>
<body>
<h1>Error response</h1>
<p>Error code %(code)d.
<p>Message: %(message)s.
<p>Error code explanation: %(code)s = %(explain)s.
...