Package shttp :: Module sHTTP :: Class HTTP
[hide private]
[frames] | no frames]

Class HTTP

source code

HTTPBase --+
           |
          HTTP

The light weight HTTP Server

Instance Methods [hide private]
 
__del__(self) source code
 
__init__(self, reqsocket, handlers=None)
Initialize the HTTP server, uses the socket |reqsocket| and uses |handlers| (a dictionary methodname -> handlerfunction) as handlers to methods.
source code
 
set_servername(self, servername) source code
 
send_response_header(self, httpversion='HTTP/1.1', status=200, status_string=None)
Send the first line with the response of the request |httpversion| is the version of the http response |status| the reponse status |status_string| a human readable status
source code
 
init_request(self) source code
 
send_headers(self, headers, status=200) source code
 
send_page(self, stringdata, headers=None, status=200)
Send a page with data |stringdata|, headers |headers|, and the status |status| (default OK: 200)
source code
 
resolve(self)
Resolve a request using handlers, if there is no handler, it responses with 405 error
source code
 
request_error(self, string)
Request error manager
source code
 
header_error(self, string)
Header error manager
source code

Inherited from HTTPBase: __getitem__, close, close_socket, get_content, get_httpversion, get_method, get_uri, put_headers, read_headers, set_socket

Inherited from HTTPBase (private): _read, _readline, _write

Method Details [hide private]

__del__(self)
(Destructor)

source code 
Overrides: HTTPBase.__del__

__init__(self, reqsocket, handlers=None)
(Constructor)

source code 
Initialize the HTTP server, uses the socket |reqsocket| and uses |handlers| (a dictionary methodname -> handlerfunction) as handlers to methods. An URI handler can be used inside the method handler.
Overrides: HTTPBase.__init__

request_error(self, string)

source code 
Request error manager
Overrides: HTTPBase.request_error

header_error(self, string)

source code 
Header error manager
Overrides: HTTPBase.header_error