Skip to content
Permalink
Browse files

http: reuse noop function in socketOnError()

PR-URL: #25566
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information...
cjihrig authored and MylesBorins committed Jan 18, 2019
1 parent 13205d5 commit 33a9d17733f1d2b9a0098478f6572b3660d48356
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/_http_server.js
@@ -499,14 +499,15 @@ function onParserExecute(server, socket, parser, state, ret) {
onParserExecuteCommon(server, socket, parser, state, ret, undefined);
}

const noop = () => {};
const badRequestResponse = Buffer.from(
`HTTP/1.1 400 ${STATUS_CODES[400]}${CRLF}` +
`Connection: close${CRLF}${CRLF}`, 'ascii'
);
function socketOnError(e) {
// Ignore further errors
this.removeListener('error', socketOnError);
this.on('error', () => {});
this.on('error', noop);

if (!this.server.emit('clientError', e, this)) {
if (this.writable) {

0 comments on commit 33a9d17

Please sign in to comment.
You can’t perform that action at this time.