Package wtf :: Package impl :: Package http :: Module _request :: Class HTTPRequest
[hide private]
[frames] | no frames]

Class HTTPRequest

source code

object --+
         |
        HTTPRequest

HTTP Request abstraction
Instance Methods [hide private]
 
__init__(self, server, connection, flags)
Initialization
source code
 
close(self)
Close all streams
source code
any
__getattr__(self, name)
Delegate call to the current state implementation
source code
dict
parse(self)
Parse the request
source code
 
error(self, status, message)
Emit a simple error
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _response_status_line = None
  expects_100 = False
  sent_100 = False
Instance Variables [hide private]
HTTPConnection connection = None
HTTP connection abstraction
wtf.stream.GenericStream _request_body_stream = None
Stream for accessing the request body (or None).
wtf.stream.GenericStream _response_body_stream = None
Stream for writing the response body (or None)
http.HTTPServer _server
HTTP server instance
wtf.impl.FlagsInterface flags
Worker flags
dict headers = None
Request header dictionary
tuple http_version
Maximum supported HTTP version
str method = 'GET'
Request method used
tuple protocol = (0, 9)
Request protocol version
dict response_headers = None
Response headers sent to the client
int response_status = None
Response status code sent to the client
BaseState state
Current state object.
str url = '*'
Request URL
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, server, connection, flags)
(Constructor)

source code 
Initialization
Parameters:
Overrides: object.__init__

__getattr__(self, name)
(Qualification operator)

source code 
Delegate call to the current state implementation
Parameters:
  • name (str) - The symbol to fetch
Returns: any
The resolved symbol depending on the state (should be a callable)

parse(self)

source code 
Parse the request
Returns: dict
Request environment (based on the connection environment)

error(self, status, message)

source code 
Emit a simple error
Parameters:
  • status (str) - The status line to emit, it will be repeated in the body (which is labeled text/plain for >= HTTP/1.0 or wrapped into HTML for HTTP/0.9)
  • message (str) - The message to emit

Instance Variable Details [hide private]

_request_body_stream

Stream for accessing the request body (or None). Transfer encodings and the Expect/Continue mechanism are dealt with transparently. Just read it.
Type:
wtf.stream.GenericStream
Value:
None

state

Current state object. Additional methods and properties are looked up there (see BaseState for documentation)
Type:
BaseState