Properly respond to HTTP HEAD requests during end(body) hot path #1291

Closed
wants to merge 5 commits into
from

Projects

None yet

2 participants

@reid
reid commented Jul 8, 2011

During write(), _hasBody is checked to make sure a body is allowed -- this is now also checked during end(body)'s hot path when write() isn't used.

Without this patch, it's possible that res.end("foo") can send a malformed HEAD response that http_parser rejects.

Includes a new test.

reid added some commits Jul 8, 2011
@reid reid Properly respond to HEAD during end(body) hot path
During write(), _hasBody is checked to make sure a body
is allowed -- this is now also checked during end(body)
when write() isn't used.
95a6f40
@reid reid Correct quote style. 4a0a8c6
@reid reid Correct quote style for test. 776c25c
@reid reid Concise final chunk for HEAD req's res.end(data).
Instead of simply clearing data, check _hasBody
earlier to avoid sending cruft when chunkedEncoding
is used.
f7d7132
@reid reid Merge branch 'master' into http-end-head d8617f5
@koichik koichik added a commit that closed this pull request Jul 19, 2011
@reid @koichik reid + koichik Properly respond to HEAD during end(body) hot path
During write(), _hasBody is checked to make sure a body
is allowed -- this is now also checked during end(body)
when write() isn't used.

Concise final chunk for HEAD req's res.end(data).

Instead of simply clearing data, check _hasBody
earlier to avoid sending cruft when chunkedEncoding
is used.

Fixes #1291.
973153d
@koichik koichik closed this in 973153d Jul 19, 2011
@koichik
koichik commented Jul 19, 2011

I squashed these commits into a single commit.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment