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

@kanongil kanongil commented May 24, 2016

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.

@stanislav-polishchuk
Copy link

@stanislav-polishchuk stanislav-polishchuk commented Jun 8, 2016

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

@hueniverse
Copy link
Contributor

@hueniverse hueniverse commented Jun 8, 2016

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
1 check passed
hueniverse added a commit that referenced this issue Jul 6, 2016
@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

3 participants