Skip to content

Fix gzip modifies headers#134

Open
OrkhanAlikhanov wants to merge 7 commits intogin-contrib:masterfrom
OrkhanAlikhanov:fix/gzip-modifies-headers
Open

Fix gzip modifies headers#134
OrkhanAlikhanov wants to merge 7 commits intogin-contrib:masterfrom
OrkhanAlikhanov:fix/gzip-modifies-headers

Conversation

@OrkhanAlikhanov
Copy link

@OrkhanAlikhanov OrkhanAlikhanov commented Nov 26, 2025

Asked sonnet 4.5 to fix #133

From my review the code is legit, it only sets headers only if it goes ahead with compression (e.i g.writer.Write call)

Edit:

  • I had to fix another issue where when the upstream gzip was sent in chunks it was correctly passing through the first chunk but was compressing the subsequent ones, thus resulting in invalid data.
  • Also removed the code where it sets "Content-Length" in defer statement, it does not make sense to set header after body was already written. It was basically no-op.
  • Sorry for kinda major rework but test cases should be universal. They do not pass in v1.2.5

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.

Gzip Middleware removes headers that were not set by itself

1 participant