Skip to content

fix(middleware): accept gzip bodies exactly at the size limit - #3136

Open
Shubham-Padkonde wants to merge 1 commit into
labstack:masterfrom
Shubham-Padkonde:fix/decompress-exact-size-limit
Open

Shubham-Padkonde wants to merge 1 commit into
labstack:masterfrom
Shubham-Padkonde:fix/decompress-exact-size-limit

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

When a gzip body has exactly MaxDecompressedSize bytes, reading once more currently returns HTTP 413 instead of EOF. This can reject a valid body even though it stays within the configured limit.

Probe for one more decompressed byte after reaching the limit. EOF remains successful, while actual excess data returns 413 and subsequent reads retain that error. Empty reads do not consume the probe.

Added regressions using real gzip streams for the exact boundary and repeated reads after exceeding it. The exact-boundary regression fails before the fix.

Validation: go test ./... -count=1 and go vet ./... pass on Windows; go test -race ./... passes on Ubuntu.

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