circuits.web.parsers.http module

exception circuits.web.parsers.http.InvalidRequestLine

Bases: Exception

error raised when first line is invalid

exception circuits.web.parsers.http.InvalidHeader

Bases: Exception

error raised on invalid header

exception circuits.web.parsers.http.InvalidChunkSize

Bases: Exception

error raised when we parse an invalid chunk size

class circuits.web.parsers.http.HttpParser(kind=2, decompress=False)

Bases: object

get_version()
get_method()
get_status_code()
get_url()
get_scheme()
get_path()
get_query_string()
get_headers()
recv_body()

return last chunk of the parsed body

recv_body_into(barray)

Receive the last chunk of the parsed body and store the data in a buffer rather than creating a new string.

is_upgrade()

Do we get upgrade header in the request. Useful for websockets

is_headers_complete()

return True if all headers have been parsed.

is_partial_body()

return True if a chunk of body have been parsed

is_message_begin()

return True if the parsing start

is_message_complete()

return True if the parsing is done (we get EOF)

is_chunked()

return True if Transfer-Encoding header value is chunked

should_keep_alive()

return True if the connection should be kept alive

execute(data, length)