Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 committed Jan 20, 2019
commit 5571c0ddebe72e894e41bbee56c7165a55788288
3 changes: 2 additions & 1 deletion lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down