Skip to content

Commit

Permalink
http: reuse noop function in socketOnError()
Browse files Browse the repository at this point in the history
PR-URL: #25566
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
cjihrig authored and BethGriggs committed Apr 29, 2019
1 parent 8d309dc commit ff30a37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ff30a37

Please sign in to comment.