Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix statusCode 0 write panic #291

Merged
merged 6 commits into from
Aug 19, 2021
Merged

Fix statusCode 0 write panic #291

merged 6 commits into from
Aug 19, 2021

Conversation

malud
Copy link
Collaborator

@malud malud commented Aug 18, 2021

This pull request should fix two rare cases which would lead to possible statusCode 0 writes to the client. A panic thrown by the http package will prevent this. One way could be to read an invalid gzip header and processing further with already read body bytes (gzipheader, 10bytes) which could also lead to content-length != body.len write errors.

a) handle gzip reader creation error, reset backend response body
b) add a fallback to our responseWriter to write at least status 500


Reviewer checklist
  • Read PR description: a summary about the changes is required
  • Changelog updated
  • Documentation: docs/{Reference, Cli, ...}, Docker and cli help/usage
  • Pulled branch, manually tested
  • Verified requirements are met
  • Reviewed the code
  • Reviewed the related tests

Marcel Ludwig added 4 commits August 18, 2021 09:30
With this initialization the gzip header will be read. This could throw an invalid header error.
In combination with content-length a follow up error while writing to the client (CL != Body) is not helpful at all.
Handle worst case scenario to prevent a panic thrown by http package
reduce png bytes, fmt check
alex-schneider
alex-schneider previously approved these changes Aug 18, 2021
@malud malud merged commit cab0670 into master Aug 19, 2021
@malud malud deleted the fix-status-0 branch August 19, 2021 09:28
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.

2 participants