rpki.https.http_stream Class Reference
Inherits asynchat::async_chat.
Inherited by rpki.https.http_client, and rpki.https.http_server.
List of all members.
Detailed Description
Virtual class representing an HTTP message stream.
Definition at line 280 of file https.py.
Member Function Documentation
def rpki.https.http_stream.__init__ |
( |
|
self, |
|
|
|
sock = None | |
|
) |
| | |
def rpki.https.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 382 of file https.py.
def rpki.https.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 394 of file https.py.
def rpki.https.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 404 of file https.py.
def rpki.https.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 366 of file https.py.
def rpki.https.http_stream.close |
( |
|
self, |
|
|
|
force = False | |
|
) |
| | |
Close the stream.
Graceful shutdown of a TLS connection requires multiple calls to
the underlying TLS code. If the connection should be closed right
now without waiting (perhaps because it's already dead and we're
just cleaning up), call with force = True.
Definition at line 560 of file https.py.
def rpki.https.http_stream.collect_incoming_data |
( |
|
self, |
|
|
|
data | |
|
) |
| | |
Buffer incoming data from asynchat.
Definition at line 318 of file https.py.
def rpki.https.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.
Definition at line 333 of file https.py.
def rpki.https.http_stream.get_buffer |
( |
|
self |
) |
|
Consume data buffered from asynchat.
Definition at line 325 of file https.py.
def rpki.https.http_stream.handle_body |
( |
|
self |
) |
|
Hand normal (not chunked) message off to the application.
Definition at line 415 of file https.py.
def rpki.https.http_stream.handle_close |
( |
|
self |
) |
|
def rpki.https.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.https.http_client.
Definition at line 422 of file https.py.
def rpki.https.http_stream.handle_read |
( |
|
self |
) |
|
Asyncore says socket is readable. Make sure there's no TLS write
already in progress, retry previous read operation if we had one
that was waiting for more input, otherwise try to read some data,
and handle all the weird OpenSSL exceptions that the TLS code
throws.
Definition at line 489 of file https.py.
def rpki.https.http_stream.handle_timeout |
( |
|
self |
) |
|
def rpki.https.http_stream.handle_write |
( |
|
self |
) |
|
Asyncore says socket is writeable. Make sure there's no TLS read
already in progress, retry previous write operation if we had one
that was blocked on the socket, otherwise try to write some data.
Handling all the weird OpenSSL exceptions that TLS throws is our
caller's problem.
Definition at line 517 of file https.py.
def rpki.https.http_stream.initiate_send |
( |
|
self |
) |
|
Initiate a write operation. This is just a wrapper around the
asynchat method, to handle all the whacky TLS exceptions.
Definition at line 541 of file https.py.
def rpki.https.http_stream.log_cert |
( |
|
self, |
|
|
|
tag, |
|
|
|
x | |
|
) |
| | |
Log HTTPS certificates, if certificate debugging is enabled.
Definition at line 597 of file https.py.
def rpki.https.http_stream.readable |
( |
|
self |
) |
|
TLS replacement for normal asynchat .readable() method. A TLS
connection that's blocked waiting for TLS write is considered not
readable even if the underlying socket is.
Definition at line 473 of file https.py.
def rpki.https.http_stream.recv |
( |
|
self, |
|
|
|
buffer_size | |
|
) |
| | |
TLS replacement for normal asyncore .recv() method. Throw an
exception if TLS hasn't been started or if TLS I/O was already in
progress, otherwise hand off to the TLS code.
Definition at line 463 of file https.py.
def rpki.https.http_stream.restart |
( |
|
self |
) |
|
(Re)start HTTP message parser, reset timer.
Definition at line 296 of file https.py.
def rpki.https.http_stream.send |
( |
|
self, |
|
|
|
data | |
|
) |
| | |
TLS replacement for normal asyncore .send() method. Throw an
exception if TLS hasn't been started or if TLS I/O was already in
progress, otherwise hand off to the TLS code.
Definition at line 453 of file https.py.
def rpki.https.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 305 of file https.py.
def rpki.https.http_stream.writeable |
( |
|
self |
) |
|
TLS replacement for normal asynchat .writeable() method. A TLS
connection that's blocked waiting for TLS read is considered not
writeable even if the underlying socket is.
Definition at line 481 of file https.py.
Member Data Documentation
The documentation for this class was generated from the following file: