Documentation
¶
Overview ¶
Package compress provides HTTP response compression middleware and utilities. It supports brotli (pre-compressed only), gzip (pre-compressed + on-the-fly), and transparent passthrough for already-compressed content types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptsEncoding ¶
AcceptsEncoding reports whether the Accept-Encoding header includes enc. It parses the comma-separated list without allocating. Returns false if the encoding is explicitly rejected with q=0 (RFC 7231 §5.3.4).
func GzipBytes ¶
GzipBytes compresses src with the configured level and returns the result. Used during cache population to pre-compress file contents.
func IsCompressible ¶
IsCompressible reports whether the given content type should be compressed.
func Middleware ¶
Middleware returns an http.Handler that adds on-the-fly gzip compression for compressible content types when the client signals support. Pre-compressed serving (br/gz sidecar files) is handled in the file handler; this middleware only handles the on-the-fly gzip fallback for uncached or large files that bypass the cache.
Types ¶
This section is empty.