contentcoding

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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