Skip to content

fix(middleware): finish gzip streams after flush-only handlers - #3208

Open
anqorithm wants to merge 1 commit into
labstack:masterfrom
anqorithm:abdallah/fix-gzip-flush-footer
Open

anqorithm wants to merge 1 commit into
labstack:masterfrom
anqorithm:abdallah/fix-gzip-flush-footer

Conversation

@anqorithm

Copy link
Copy Markdown

A handler that flushes a gzip response without writing a body sends a gzip header but loses its trailer during deferred cleanup, so clients get unexpected EOF. Mark Flush as writing the response so cleanup closes the gzip stream on the actual response writer.

Added regressions for default settings, a minimum compression length, and repeated flushes; all three fail before the fix. The full test suite passes with the race detector, and build, go vet, staticcheck and import checks pass.

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