http: reuse noop function in socketOnError()
PR-URL: https://github.com/nodejs/node/pull/25566 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
17c6b1d4f7
commit
5571c0ddeb
@ -503,13 +503,14 @@ 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}${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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user