harp.utils.bytes¶
- header_bytes(x)[source]¶
Encode a header name or value for the wire. Latin-1 round-trips what we decoded, utf-8 covers the rest.
- header_display(x)[source]¶
Readable text for a wire-form (latin-1) header: utf-8 when the bytes are valid utf-8, else as is.
- header_str(x)[source]¶
Decode a header name or value from the wire. Never fails, and
header_bytes()gives the bytes back.
- HEADER_ENCODING = 'latin-1'¶
Header values are opaque octets (RFC 9110 §5.5, obs-text): one char per byte, whatever the bytes are.