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.

Refs: #43587 (comment)
Refs: #43587 (comment)
PR-URL: #44921
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
  • Loading branch information
lpinca authored and danielleadams committed Jan 3, 2023
1 parent 8c2d0f9 commit 2882e60
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 @@ -813,10 +813,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 2882e60

Please sign in to comment.