Skip to content

fix(middleware): match gzip Content-Encoding case-insensitively (v4) - #3148

Open
orinnz wants to merge 1 commit into
labstack:v4from
orinnz:fix/v4-decompress-gzip-case
Open

orinnz wants to merge 1 commit into
labstack:v4from
orinnz:fix/v4-decompress-gzip-case

Conversation

@orinnz

@orinnz orinnz commented Oct 3, 2026

Copy link
Copy Markdown

Backport of #3056 to v4.

Decompress only handled an exact Content-Encoding: gzip. If a client sent GZIP or Gzip, the body reached the handler still compressed. Content codings are case-insensitive (RFC 9110 §8.4.1), so the check now uses strings.EqualFold.

Added TestDecompressContentEncodingCaseInsensitive. It fails before the change and passes after. go test ./... passes.

Decompress only acted on an exact "gzip" Content-Encoding, so a body
sent with "GZIP" or "Gzip" reached the handler still compressed.
Content codings are case-insensitive (RFC 9110 section 8.4.1).

Backport of labstack#3056.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant