Closed
Conversation
`clientError` will have `http.Server`-specific behavior, and we don't want to shadow it in `tls.Server`.
Make default `clientError` behavior (close socket immediately)
overridable. With this APIs it is possible to write a custom error
handler, and to send, for example, a 400 HTTP response.
http.createServer(...).on('clientError', function(err, socket) {
socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');
socket.destroy();
});
Fix: nodejs#4543
Member
Author
|
cc @nodejs/http |
doc/api/http.markdown
Outdated
Contributor
There was a problem hiding this comment.
Perhaps: "Default behavior is to destroy the socket immediately."
There was a problem hiding this comment.
For people searching the page, mentioning "malformed request" or "invalid HTTP" would be helpful.
Member
|
Should there be a test that triggers clientError with and without the override to confirm both more-or-less basically work as expected? Or is the idea that the modified TLS tests already check the override and other existing tests already check the basic behavior? |
Member
Author
|
@Trott yep, I will write a test. Thank you for suggestion |
Member
Author
|
@Trott how about this? ;) |
Member
Author
|
@mscdex PTAL |
Member
Author
Contributor
|
LGTM if CI is ok with it. |
Member
Author
indutny
added a commit
that referenced
this pull request
Jan 7, 2016
`clientError` will have `http.Server`-specific behavior, and we don't want to shadow it in `tls.Server`. PR-URL: #4557 Reviewed-By: Brian White <mscdex@mscdex.net>
indutny
added a commit
that referenced
this pull request
Jan 7, 2016
Make default `clientError` behavior (close socket immediately)
overridable. With this APIs it is possible to write a custom error
handler, and to send, for example, a 400 HTTP response.
http.createServer(...).on('clientError', function(err, socket) {
socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');
socket.destroy();
});
Fix: #4543
PR-URL: #4557
Reviewed-By: Brian White <mscdex@mscdex.net>
This was referenced Dec 7, 2023
This was referenced Dec 7, 2023
This was referenced Dec 7, 2023
This was referenced Dec 8, 2023
This was referenced Dec 8, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See: #4543