circuits.web.parsers.http module

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

Bases: object

execute(data, length)
get_headers()
get_method()
get_path()
get_query_string()
get_scheme()
get_status_code()
get_url()
get_version()
is_chunked()

return True if Transfer-Encoding header value is chunked

is_headers_complete()

return True if all headers 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_partial_body()

return True if a chunk of body have been parsed

is_upgrade()

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

recv_body()

return last chunk of the parsed body

recv_body_into(barray)

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

should_keep_alive()

return True if the connection should be kept alive

exception circuits.web.parsers.http.InvalidChunkSize

Bases: exceptions.Exception

error raised when we parse an invalid chunk size

exception circuits.web.parsers.http.InvalidHeader

Bases: exceptions.Exception

error raised on invalid header

exception circuits.web.parsers.http.InvalidRequestLine

Bases: exceptions.Exception

error raised when first line is invalid