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

Class HTTP

HTTPBase --+
           |
          HTTP


The light weight HTTP Server
Method Summary
  __init__(self, reqsocket, handlers)
Initialize the HTTP server, uses the socket |reqsocket| and uses |handlers| (a dictionary methodname -> handlerfunction) as handlers to methods.
  __del__(self)
  header_error(self, string)
Header error manager
  init_request(self)
  request_error(self, string)
Request error manager
  resolve(self)
Resolve a request using handlers, if there is no handler, it responses with 405 error
  send_headers(self, headers, status)
  send_page(self, stringdata, headers, status)
Send a page with data |stringdata|, headers |headers|, and the status |status| (default OK: 200)
  send_response_header(self, httpversion, status, status_string)
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
  set_servername(self, servername)
    Inherited from HTTPBase
  __getitem__(self, v)
Get the |v| HTTP header
  close(self)
close the Object
  close_socket(self)
  get_content(self, just_file_pointer, get_raw_data)
Return the content of the document (a POST in the server, a response int the client)
  get_httpversion(self)
The version of the HTTP used
  get_method(self)
What method is used to communicate (i.e.
  get_uri(self)
The URI or requested location
  put_headers(self, headers)
Send the headers, including the response|request
  read_headers(self)
Read the headers and the (response status|request)
  set_socket(self, commsocket, usingssl)
Change the socket that connecs peers
  _read(self)
  _readline(self, max)
  _write(self, data)

Method Details

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

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:
shttp.sHTTP.HTTPBase.__init__

header_error(self, string)

Header error manager
Overrides:
shttp.sHTTP.HTTPBase.header_error

request_error(self, string)

Request error manager
Overrides:
shttp.sHTTP.HTTPBase.request_error

resolve(self)

Resolve a request using handlers, if there is no handler, it responses with 405 error

send_page(self, stringdata, headers=None, status=200)

Send a page with data |stringdata|, headers |headers|, and the status |status| (default OK: 200)

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

Generated by Epydoc 2.1 on Sat Oct 14 11:50:52 2006 http://epydoc.sf.net