HTTPRequest

An HTTP Request (and response).

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

connection: the HTTP Connection object which spawned this request. rfile: the 'read' fileobject from the connection's socket ready: when True, the request has been parsed and is ready to begin

System Message: ERROR/3 (paste.script.wsgiserver.HTTPRequest, line 6)

Unexpected indentation.
generating the response. When False, signals the calling Connection that the response should not be generated and the connection should close.

System Message: WARNING/2 (paste.script.wsgiserver.HTTPRequest, line 9)

Block quote ends without a blank line; unexpected unindent.
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.
chunked_write: if True, output will be encoded with the "chunked"
transfer-coding. This value is set automatically inside send_headers.

Methods

f __init__(self, connection) ...

f parse_request(self) ...

Parse the next HTTP request start-line and message-headers.

f read_headers(self) ...

Read header lines from the incoming stream.

f decode_chunked(self) ...

Decode the 'chunked' transfer coding.

f respond(self) ...

Call the appropriate WSGI app and write its iterable output.

f simple_response(self, status, msg='') ...

Write a simple response back to the client.

f start_response(self, status, headers, exc_info=None) ...

WSGI callable to begin the HTTP response.

f write(self, chunk) ...

WSGI callable to write unbuffered data to the client.

This method is also used internally by start_response (to write data from the iterable returned by the WSGI application).

f send_headers(self) ...

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

See the source for more information.