Module

_dictionary_endpoint

Built-in dictionary serving endpoint for RFC 9842 compression dictionaries.

Serves dictionary files at/.well-known/compression-dictionary/<hash> so clients can download dictionaries advertised viaUse-As-Dictionary.

Also providesuse_as_dictionary_headersfor injecting the Use-As-Dictionaryresponse header on matching paths, enabling browser dictionary discovery.

Functions

build_dictionary_response 2 tuple[int, list[tuple[by…
Build a response serving a dictionary file by its sf-hash.
def build_dictionary_response(dictionaries: tuple[CompressionDictionary, ...], path: str) -> tuple[int, list[tuple[bytes, bytes]], bytes] | None
Parameters
Name Type Description
dictionaries tuple[CompressionDictionary, ...]

Loaded server dictionaries.

path str

Request path (e.g./.well-known/compression-dictionary/:abc=:).

Returns
tuple[int, list[tuple[bytes, bytes]], bytes] | None
use_as_dictionary_headers 2 list[tuple[bytes, bytes]]
Return ``Use-As-Dictionary`` headers for matching dictionaries. For each dicti…
def use_as_dictionary_headers(dictionaries: tuple[CompressionDictionary, ...], request_target: str) -> list[tuple[bytes, bytes]]

ReturnUse-As-Dictionaryheaders for matching dictionaries.

For each dictionary whosematchpattern covers the request target, returns a header telling the browser to fetch and cache the dictionary for future requests to matching URLs.

Parameters
Name Type Description
dictionaries tuple[CompressionDictionary, ...]

Loaded server dictionaries.

request_target str

The request URL path.

Returns
list[tuple[bytes, bytes]]