fix(middleware): match gzip Content-Encoding case-insensitively#3056
fix(middleware): match gzip Content-Encoding case-insensitively#3056sonnemusk wants to merge 2 commits into
Conversation
Proxies and clients may send Content-Encoding: Gzip or GZIP. Exact string compare skipped decompression. Trim and EqualFold against "gzip".
|
I am not agains this change but please give us real world example then |
|
This is primarily RFC compliance, not a custom client quirk. RFC 9110 §8.4.1 (and earlier HTTP RFCs) define content codings as case-insensitive. So Real-world sources of non-lowercase values:
The |
Drop TrimSpace so the change is strictly RFC 9110 case-insensitivity for content codings, per review discussion.
|
Follow-up: I dropped the Concrete cases this fixes:
Happy to adjust further if you want a different approach. |
c4b0fdd to
c7d2c83
Compare
Summary
Decompress middleware only accepted exact
Content-Encoding: gzip. Values likeGziporGZIPwere skipped.Change
strings.EqualFoldafter trim.Test plan
go test ./middleware -run TestDecompress