RPKI Engine
1.0
|
Public Member Functions | |
def | __init__ |
def | __repr__ |
def | chunk_body |
def | chunk_discard_crlf |
def | chunk_discard_trailer |
def | chunk_header |
def | collect_incoming_data |
def | found_terminator |
def | get_buffer |
def | handle_body |
def | handle_close |
def | handle_error |
def | handle_timeout |
def | restart |
def | update_timeout |
Public Attributes | |
buffer | |
chunk_handler | |
msg | |
timer | |
Static Public Attributes | |
log = log_method |
def rpki::http::http_stream::__repr__ | ( | self | ) |
Definition at line 305 of file http.py.
References rpki::http::http_client::addr, and rpki::http::addr_to_string().
def rpki::http::http_stream::chunk_body | ( | self | ) |
Asynchat just handed us what should be the body of a chunk of the body of a chunked message (sic). Save it, and prepare to move on to the next chunk.
Definition at line 405 of file http.py.
References buffer, chunk_discard_crlf(), chunk_handler, log, and msg.
Referenced by chunk_header().
def rpki::http::http_stream::chunk_discard_crlf | ( | self | ) |
Consume the CRLF that terminates a chunk, reinitialize chunk decoder to be ready for the next chunk.
Definition at line 417 of file http.py.
References chunk_handler, chunk_header(), get_buffer(), and log.
Referenced by chunk_body().
def rpki::http::http_stream::chunk_discard_trailer | ( | self | ) |
Consume chunk trailer, which should be empty, then (finally!) exit the chunk decoder and hand complete message off to the application.
Definition at line 427 of file http.py.
References chunk_handler, get_buffer(), rpki::http::http_server::handle_message(), rpki::http::http_client::handle_message(), and log.
Referenced by chunk_header().
def rpki::http::http_stream::chunk_header | ( | self | ) |
Asynchat just handed us what should be the header of one chunk of a chunked encoding stream. If this chunk has a body, set the stream up to read it; otherwise, this is the last chunk, so start the process of exiting the chunk decoder.
Definition at line 389 of file http.py.
References chunk_body(), chunk_discard_trailer(), chunk_handler, get_buffer(), log, and msg.
Referenced by chunk_discard_crlf().
def rpki::http::http_stream::collect_incoming_data | ( | self, | |
data | |||
) |
Buffer incoming data from asynchat.
Definition at line 341 of file http.py.
References update_timeout().
def rpki::http::http_stream::found_terminator | ( | self | ) |
Asynchat reported that it found whatever terminator we set, so figure out what to do next. This can be messy, because we can be in any of several different states: @li We might be handling chunked HTTP, in which case we have to initialize the chunk decoder; @li We might have found the end of the message body, in which case we can (finally) process it; or @li We might have just gotten to the end of the message headers, in which case we have to parse them to figure out which of three separate mechanisms (chunked, content-length, TCP close) is going to tell us how to find the end of the message body.
def rpki::http::http_stream::get_buffer | ( | self | ) |
Consume data buffered from asynchat.
Definition at line 348 of file http.py.
References buffer.
Referenced by chunk_discard_crlf(), chunk_discard_trailer(), chunk_header(), and handle_body().
def rpki::http::http_stream::handle_body | ( | self | ) |
Hand normal (not chunked) message off to the application.
Definition at line 438 of file http.py.
References get_buffer(), rpki::http::http_server::handle_message(), rpki::http::http_client::handle_message(), and msg.
Referenced by rpki::http::http_client::handle_close().
def rpki::http::http_stream::handle_close | ( | self | ) |
Wrapper around asynchat connection close handler, so that we can log the event, cancel timer, and so forth.
Reimplemented in rpki::http::http_client.
Definition at line 467 of file http.py.
References log.
def rpki::http::http_stream::handle_error | ( | self | ) |
Asynchat (or asyncore, or somebody) raised an exception. See whether it's one we should just pass along, otherwise log a stack trace and close the stream.
Reimplemented in rpki::http::http_client.
Definition at line 445 of file http.py.
References rpki::sql::session::close(), rpki::myrpki::csv_writer::close(), rpki::myrpki::IRDB::close(), and log.
Referenced by rpki::http::http_client::dns_error(), rpki::http::http_listener::handle_accept(), and rpki::http::http_client::handle_timeout().
def rpki::http::http_stream::handle_timeout | ( | self | ) |
Inactivity timer expired, close connection with prejudice.
Reimplemented in rpki::http::http_client.
Definition at line 460 of file http.py.
References rpki::sql::session::close(), rpki::myrpki::csv_writer::close(), rpki::myrpki::IRDB::close(), and log.
def rpki::http::http_stream::restart | ( | self | ) |
(Re)start HTTP message parser, reset timer.
Definition at line 319 of file http.py.
Referenced by rpki::http::http_queue::return_result(), rpki::http::http_server::send_message(), and rpki::http::http_client::send_request().
def rpki::http::http_stream::update_timeout | ( | self | ) |
Put this stream's timer in known good state: set it to the stream's timeout value if we're doing timeouts, otherwise clear it.
Definition at line 328 of file http.py.
References log, rpki::http::http_server::timeout, and rpki::http::http_client::timeout.
Referenced by collect_incoming_data(), and rpki::http::http_client::handle_message().
Definition at line 313 of file http.py.
Referenced by chunk_body(), and get_buffer().
Definition at line 321 of file http.py.
Referenced by chunk_body(), chunk_discard_crlf(), chunk_discard_trailer(), and chunk_header().
rpki::http::http_stream::log = log_method [static] |
Definition at line 303 of file http.py.
Referenced by chunk_body(), chunk_discard_crlf(), chunk_discard_trailer(), chunk_header(), rpki::http::http_queue::detach(), rpki::http::http_listener::handle_accept(), handle_close(), rpki::http::http_client::handle_close(), rpki::http::http_client::handle_connect(), handle_error(), rpki::http::http_listener::handle_error(), rpki::http::http_client::handle_error(), rpki::http::http_server::handle_message(), rpki::http::http_client::handle_message(), handle_timeout(), rpki::http::http_client::handle_timeout(), rpki::http::http_queue::request(), rpki::http::http_queue::restart(), rpki::http::http_queue::return_result(), rpki::http::http_server::send_message(), rpki::http::http_client::send_request(), rpki::http::http_client::set_state(), rpki::http::http_client::start(), and update_timeout().
Definition at line 371 of file http.py.
Referenced by chunk_body(), chunk_header(), handle_body(), rpki::http::http_server::handle_message(), and rpki::http::http_client::handle_message().