Package cherrypy :: Package wsgiserver :: Module wsgiserver3 :: Class HTTPRequest
[hide private]
[frames] | no frames]

Class HTTPRequest

source code

object --+
         |
        HTTPRequest

An HTTP Request (and response).

A single HTTP connection may consist of multiple request/response pairs.

Instance Methods [hide private]
 
__init__(self, server, conn)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
parse_request(self)
Parse the next HTTP request start-line and message-headers.
source code
 
read_request_line(self) source code
 
read_request_headers(self)
Read self.rfile into self.inheaders.
source code
 
parse_request_uri(self, uri)
Parse a Request-URI into (scheme, authority, path).
source code
 
unquote_bytes(self, path)
takes quoted string and unquotes % encoded values
source code
 
respond(self)
Call the gateway and write its iterable output.
source code
 
simple_response(self, status, msg="")
Write a simple response back to the client.
source code
 
write(self, chunk)
Write unbuffered data to the client.
source code
 
send_headers(self)
Assert, process, and send the HTTP response message-headers.
source code

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

Class Variables [hide private]
  server = None
The HTTPServer object which is receiving this request.
  conn = None
The HTTPConnection object on which this request connected.
  inheaders = {}
A dict of request headers.
  outheaders = []
A list of header tuples to write in the response.
  ready = False
When True, the request has been parsed and is ready to begin generating the response.
  close_connection = False
Signals the calling Connection that the request should close.
  chunked_write = False
If True, output will be encoded with the "chunked" transfer-coding.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, server, conn)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

read_request_headers(self)

source code 

Read self.rfile into self.inheaders. Return success.

parse_request_uri(self, uri)

source code 

Parse a Request-URI into (scheme, authority, path).

Note that Request-URI's must be one of:

   Request-URI    = "*" | absoluteURI | abs_path | authority

Therefore, a Request-URI which starts with a double forward-slash cannot be a "net_path":

   net_path      = "//" authority [ abs_path ]

Instead, it must be interpreted as an "abs_path" with an empty first path segment:

   abs_path      = "/"  path_segments
   path_segments = segment *( "/" segment )
   segment       = *pchar *( ";" param )
   param         = *pchar

send_headers(self)

source code 

Assert, process, and send the HTTP response message-headers.

You must set self.status, and self.outheaders before calling this.


Class Variable Details [hide private]

ready

When True, the request has been parsed and is ready to begin generating the response. When False, signals the calling Connection that the response should not be generated and the connection should close.

Value:
False

close_connection

Signals the calling Connection that the request should close. This does not imply an error! The client and/or server may each request that the connection be closed.

Value:
False

chunked_write

If True, output will be encoded with the "chunked" transfer-coding.

This value is set automatically inside send_headers.

Value:
False