pylsqpack¶
pylsqpack
is a wrapper around the ls-qpack library. It provides Python
Decoder and Encoder objects to read or write HTTP/3 headers compressed
with QPACK.
- class pylsqpack.Decoder(max_table_capacity: int, blocked_streams: int)¶
QPACK decoder.
- Parameters:
max_table_capacity – the maximum size in bytes of the dynamic table
blocked_streams – the maximum number of streams that could be blocked
- feed_encoder(data: bytes) List[int] ¶
Feed data from the encoder stream.
If processing the data unblocked any streams, their IDs are returned, and
resume_header()
must be called for each stream ID.If the data cannot be processed,
EncoderStreamError
is raised.- Parameters:
data – the encoder stream data
- feed_header(stream_id: int, data: bytes) Tuple[bytes, List[Tuple[bytes, bytes]]] ¶
Decode a header block and return control data and headers.
If the stream is blocked,
StreamBlocked
is raised.If the data cannot be processed,
DecompressionFailed
is raised.- Parameters:
stream_id – the ID of the stream
data – the header block data
- class pylsqpack.Encoder¶
QPACK encoder.
- apply_settings(max_table_capacity: int, blocked_streams: int) bytes ¶
Apply the settings received from the encoder.
- Parameters:
max_table_capacity – the maximum size in bytes of the dynamic table
blocked_streams – the maximum number of streams that could be blocked