contentcoding

package
v0.9.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package contentcoding decodes HTTP entity bodies by their Content-Encoding. One concern: turning the compressed bytes a transparent forwarder captured into the plaintext every post-flight consumer (usage extraction, payload capture) needs.

The pipeline runner never needs this — it strips the caller's Accept-Encoding so Go's transport hands it decompressed bodies. The proxy runner forwards Accept-Encoding verbatim (transparency is its contract), so its tee'd copy arrives however the upstream compressed it. Decoding belongs post-flight, off the hot path: the wire bytes stay untouched for the caller.

Deliberately server-side (pkg/, not sdk/): brotli and zstd pull in third-party decoders the vendorable SDK must not carry. The SDK's extractors keep their stdlib gzip sniff for standalone use; server runners decode here first so the extractor input is already plain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(body []byte, encoding string) ([]byte, error)

Decode returns body decoded per encoding (a Content-Encoding header value; comma-separated codings are applied in reverse order, per RFC 9110). An empty or identity encoding falls back to magic-byte sniffing for gzip/zstd — a forwarder that lost the header still gets its capture decoded. Unknown codings and corrupt data return an error; callers keep the raw bytes in that case.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL