abla/http/h2/hpack
Generated from source.
Import with import "abla/http/h2/hpack".
Source: abla/http/h2/hpack/entry.ab
HPACK_STATIC_NAMES (val)
val HPACK_STATIC_NAMES: array<string>
---- the tables (generated from RFC 7541 appendices A and B by tools/gen-hpack-tables.sh; do not edit) ----
HPACK_STATIC_VALUES (val)
val HPACK_STATIC_VALUES: array<string>
HPACK static table values in the same order as the static names.
HPACK_HUFFMAN_CODES (val)
val HPACK_HUFFMAN_CODES: array<int>
The code of each symbol 0..255 and EOS (256), and its length in bits (RFC 7541 appendix B).
HPACK_HUFFMAN_LENGTHS (val)
val HPACK_HUFFMAN_LENGTHS: array<int>
Bit lengths of the HPACK Huffman codes in symbol order.
HpackField (class)
class HpackField(val name: string, val value: string, val sensitive: bool = false)
One header field of a decoded block; sensitive is set for a field the sender marked never indexed.
HpackBlock (class)
class HpackBlock(val ok: bool, val fields: array<HpackField>, val error: string, val limit: bool)
A decoded block: the fields in order, or why it failed. limit is true when the failure is one of OUR limits (header list, field, field count, table size) rather than a malformed block: HTTP/2 answers a limit with ENHANCE_YOUR_CALM and a malformed block with COMPRESSION_ERROR.
hpackHuffmanEncode (fun)
fun hpackHuffmanEncode(text: string): string
The Huffman coding of text: the bytes, the last byte padded with the high bits of EOS (all ones).
HpackTable (class)
class HpackTable(var names: array<string>, var values: array<string>, var size: int, var maximum: int)
---- the dynamic table (section 2.3.2), shared by the decoder and the encoder ---- Entries are kept oldest first; the dynamic index of the newest is 62, so entry i of names has the HPACK index 62 + (size - 1 - i).
HpackDecoder (class)
class HpackDecoder(val table: HpackTable, val advertised: int, val listBytes: int, val fieldBytes: int, val fieldCount: int, var broken: bool)
A decoder with the limits it enforces. tableSize is the SETTINGS_HEADER_TABLE_SIZE we advertised (the peer may not exceed it); listBytes caps a header list (name + value + 32 per field, RFC 9113 section 6.5.2), fieldBytes one name or value, fieldCount the fields of a block.
hpackDecoderNew (fun)
fun hpackDecoderNew(tableSize: int, listBytes: int, fieldBytes: int, fieldCount: int): HpackDecoder
Returns a new decoder with an empty dynamic table and the supplied header limits.
HpackDecoder.tableBytes (extension fun)
fun HpackDecoder.tableBytes(): int
The bytes of the dynamic table (tests and limits).
HpackDecoder.tableEntries (extension fun)
fun HpackDecoder.tableEntries(): int
Returns the number of entries in the decoder's dynamic table.
HpackDecoder.decode (extension fun)
fun HpackDecoder.decode(block: string): HpackBlock
Decodes one whole header block. A table size update must come first (section 4.2), at most the advertised size.
HpackEncoder (class)
class HpackEncoder(val table: HpackTable, val cap: int, val neverIndex: array<string>, var pendingSmallest: int, var pendingFinal: int)
Holds the encoder's dynamic table, size cap, pending size updates, and names to avoid indexing.
hpackEncoderNew (fun)
fun hpackEncoderNew(tableSize: int, neverIndex: array<string> = []): HpackEncoder
An encoder whose table is at most tableSize bytes (the smaller of that and what the peer allows, set with setPeerTableSize). neverIndex names are sent never indexed, in addition to the built-in credential names.
HpackEncoder.setPeerTableSize (extension fun)
fun HpackEncoder.setPeerTableSize(size: int): void
The peer's SETTINGS_HEADER_TABLE_SIZE: the table shrinks or grows to the smaller of it and the cap, and the next block starts with the size update(s) section 4.2 asks for.
HpackEncoder.tableBytes (extension fun)
fun HpackEncoder.tableBytes(): int
Returns the byte size of the encoder's dynamic table.
HpackEncoder.encode (extension fun)
fun HpackEncoder.encode(fields: array<HpackField>): string
One block for fields (names lower case: HTTP/2 requires it).
Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.