Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v10.x] Revert "http: always emit close on req and res" #21809

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,8 @@ interface. This is an [`EventEmitter`][] with the following events:
added: v0.6.7
-->

Indicates that the underlying connection was terminated.
Indicates that the underlying connection was terminated before
[`response.end()`][] was called or able to flush.

### Event: 'finish'
<!-- YAML
Expand Down Expand Up @@ -1505,6 +1506,7 @@ added: v0.4.2
-->

Indicates that the underlying connection was closed.
Just like `'end'`, this event occurs only once per response.

### message.aborted
<!-- YAML
Expand Down
6 changes: 0 additions & 6 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,6 @@ function resOnFinish(req, res, socket, state, server) {
req._dump();

res.detachSocket(socket);
req.emit('close');
process.nextTick(emitCloseNT, res);

if (res._last) {
if (typeof socket.destroySoon === 'function') {
Expand All @@ -585,10 +583,6 @@ function resOnFinish(req, res, socket, state, server) {
}
}

function emitCloseNT(self) {
self.emit('close');
}

// The following callback is issued after the headers have been read on a
// new message. In this callback we setup the response object and pass it
// to the user.
Expand Down
25 changes: 0 additions & 25 deletions test/parallel/test-http-req-res-close.js

This file was deleted.