Skip to content

Commit

Permalink
Revert "http: do not leak error listeners"
Browse files Browse the repository at this point in the history
This reverts commit 736a7d8.

The patch attempted to fix an issue, signaled by a warning, caused by
an invalid API usage. However it introduced a behavior change that is
breaking userland modules.

It is a user error, so restore the original behavior and have the user
investigate and fix the issue in their code.
  • Loading branch information
lpinca committed Oct 8, 2022
1 parent 7e09c6c commit 14e4b13
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 48 deletions.
5 changes: 1 addition & 4 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,10 +809,7 @@ const requestHeaderFieldsTooLargeResponse = Buffer.from(
function socketOnError(e) {
// Ignore further errors
this.removeListener('error', socketOnError);

if (this.listenerCount('error') === 0) {
this.on('error', noop);
}
this.on('error', noop);

if (!this.server.emit('clientError', e, this)) {
// Caution must be taken to avoid corrupting the remote peer.
Expand Down
44 changes: 0 additions & 44 deletions test/parallel/test-http-socket-listeners.js

This file was deleted.

0 comments on commit 14e4b13

Please sign in to comment.