Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
BaseHTTPServer Namespace Reference

Data Structures

class  HTTPServer
 
class  BaseHTTPRequestHandler
 

Functions

def test
 

Variables

string __version__ = "0.2"
 
list __all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
 
string DEFAULT_ERROR_MESSAGE
 

Detailed Description

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).

Contents:

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

XXX To do:

- send server version
- log requests even later (to capture byte count)
- log user-agent header and other interesting goodies
- send error log to separate file
- are request names really case sensitive?

Function Documentation

def BaseHTTPServer.test (   HandlerClass = BaseHTTPRequestHandler,
  ServerClass = HTTPServer 
)
Test the HTTP request handler class.

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

Definition at line 462 of file BaseHTTPServer.py.

463  ServerClass = HTTPServer):
464  """Test the HTTP request handler class.
465 
466  This runs an HTTP server on port 8000 (or the first command line
467  argument).
468 
469  """
470 
471  if sys.argv[1:]:
472  port = int(sys.argv[1])
473  else:
474  port = 8000
475  server_address = ('', port)
476 
477  httpd = ServerClass(server_address, HandlerClass)
478 
479  sa = httpd.socket.getsockname()
480  print "Serving HTTP on", sa[0], "port", sa[1], "..."
481  httpd.serve_forever()
482 

Variable Documentation

list __all__ = ["HTTPServer", "BaseHTTPRequestHandler"]

Definition at line 66 of file BaseHTTPServer.py.

string __version__ = "0.2"

Definition at line 64 of file BaseHTTPServer.py.

string DEFAULT_ERROR_MESSAGE
Initial value:
1 = """\
2 <head>
3 <title>Error response</title>
4 </head>
5 <body>
6 <h1>Error response</h1>
7 <p>Error code %(code)d.
8 <p>Message: %(message)s.
9 <p>Error code explanation: %(code)s = %(explain)s.
10 </body>
11 """

Definition at line 75 of file BaseHTTPServer.py.