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 empty content-length handling for gzip and 204 responses #2870

Merged
merged 2 commits into from Oct 23, 2015

Conversation

@kanongil
Copy link
Contributor

@kanongil kanongil commented Oct 23, 2015

The transmit logic incorrectly considers missing content-length headers as having a payload length of 0, while it usually signals that chunked transfer encoding should be used (with any actual length).

This patch fixes this by always parsing the header value, and testing using integer comparisons instead of the current truthiness tests.

I have added 2 new tests to verify the chunked response behavior. I also fixed an existing compression test, which was actually not working as intended due to not signalling a compressible mime type.

@kanongil
Copy link
Contributor Author

@kanongil kanongil commented Oct 23, 2015

Note that this bug actually causes incorrect responses when chunked transfers are used along with response.emptyStatusCode === 204.

@hueniverse hueniverse added the bug label Oct 23, 2015
@hueniverse hueniverse added this to the 11.0.3 milestone Oct 23, 2015
@hueniverse hueniverse self-assigned this Oct 23, 2015
hueniverse added a commit that referenced this issue Oct 23, 2015
Fix empty content-length handling for gzip and 204 responses
@hueniverse hueniverse merged commit 8ca9333 into hapijs:master Oct 23, 2015
1 check passed
@lock
Copy link

@lock lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants