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

Handle thrown error from res.setHeader() and res.writeHead() #3178

Merged
merged 2 commits into from
Jul 5, 2016

Conversation

kanongil
Copy link
Contributor

The behavior of res.writeHead() is changed in Node@6 (and possibly node@4.4.5) so that it can throw a RangeError for certain statusCodes, see nodejs/node#6291. When this throws, hapi will log an internal error without sending a response.

This PR adds a try/catch to catch this error and respond with a 500 to the client instead.

Additionally, it will catch thrown errors from res.setHeader(), eg. for an empty string header, and respond as above.

@hueniverse hueniverse added the bug Bug or defect label May 24, 2016
@hueniverse hueniverse self-assigned this May 24, 2016
@stanislav-polishchuk
Copy link

Hi, @hueniverse any updates when this pull request will be merged?

@hueniverse
Copy link
Contributor

Probably another week or so.

@hueniverse hueniverse added this to the 13.5.0 milestone Jul 5, 2016
@hueniverse hueniverse merged commit 25db02a into hapijs:master Jul 5, 2016
hueniverse added a commit that referenced this pull request Jul 6, 2016
@lock
Copy link

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
bug Bug or defect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants