Skip to content

Respect q=0 in gzip content negotiation#3028

Open
freakes wants to merge 1 commit into
labstack:masterfrom
freakes:fix/gzip-respect-accept-encoding-q0
Open

Respect q=0 in gzip content negotiation#3028
freakes wants to merge 1 commit into
labstack:masterfrom
freakes:fix/gzip-respect-accept-encoding-q0

Conversation

@freakes

@freakes freakes commented Jun 26, 2026

Copy link
Copy Markdown

Summary

Fix gzip middleware to respect q=0 values in the Accept-Encoding header.

Problem

According to RFC 9110, an encoding with q=0 is explicitly unacceptable. The current implementation does not respect this quality value and may enable gzip even when the client sends:

Accept-Encoding: gzip;q=0

Solution

Update the gzip negotiation logic to honor q=0 quality values and skip gzip when it is explicitly marked as unacceptable.

Testing

  • added a regression test covering Accept-Encoding: gzip;q=0
  • go test ./middleware

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