Dynamic headers table
Types
DynHeaders = object
- A circular queue. This is an implementaion of the dynamic header table. It can be efficiently reused. HBounds ends may be out of bounds and need to be wrapped around. All functions here take care of that
DynHeadersError = object of HpackError
HBounds = object n*, v*: Slice[int32]
- Header's name and value boundaries
Procs
func `$`(q: DynHeaders): string {....raises: [], tags: [], forbids: [].}
- Use it for debugging purposes only. Use substr and cmp for anything else
func `[]`(q: DynHeaders; i: Natural): HBounds {.inline, ...raises: [], tags: [], forbids: [].}
func add(q: var DynHeaders; n, v: openArray[char]) {....raises: [], tags: [], forbids: [].}
- Add a header name and value to the table. Evicts entries that no longer fit. Items are added and removed in FIFO order
func clear(q: var DynHeaders) {.inline, ...raises: [], tags: [], forbids: [].}
- Efficiently clear the table
func clearLastResize(q: var DynHeaders) {....raises: [], tags: [], forbids: [].}
func cmp(q: DynHeaders; b: Slice[int32]; s: openArray[char]): bool {....raises: [], tags: [], forbids: [].}
- Efficiently compare a header name or value against a string
func finalSetSize(q: DynHeaders): int {....raises: [], tags: [], forbids: [].}
func hasResized(q: DynHeaders): bool {....raises: [], tags: [], forbids: [].}
func initDynHeaders(strsize: int): DynHeaders {.inline, ...raises: [], tags: [], forbids: [].}
- Initialize a dynamic headers table. strsize is the max size in bytes of all headers put together.
func initHBounds(n, v: Slice[int]): HBounds {.inline, ...raises: [], tags: [], forbids: [].}
func len(q: DynHeaders): int {.inline, ...raises: [], tags: [], forbids: [].}
func minSetSize(q: DynHeaders): int {....raises: [], tags: [], forbids: [].}
func reset(q: var DynHeaders) {....deprecated, raises: [], tags: [], forbids: [].}
- clear() instead Deprecated, use
func setSize(q: var DynHeaders; strsize: Natural) {....raises: [], tags: [], forbids: [].}
- Resize the total headers max length. Evicts entries that don't fit anymore. Set to 0 to clear it.
func substr(q: DynHeaders; s: var string; x: Slice[int32]) {....raises: [], tags: [], forbids: [].}
Iterators
iterator items(q: DynHeaders): HBounds {.inline, ...raises: [], tags: [], forbids: [].}
iterator pairs(q: DynHeaders): (int, HBounds) {.inline, ...raises: [], tags: [], forbids: [].}