Skip to content

Commit

Permalink
http: revert "http: always emit close on req and res"
Browse files Browse the repository at this point in the history
This reverts a commit that accidentally introduced a semver-major
change to Node 10 and broke userland code.
A subsequent fix to that change and documentation change are reverted
with it.

Revert "http: fix res emit close before user finish"

This reverts commit 2a9c833.

Revert "http: always emit close on req and res"

This reverts commit 8029a24.

Revert "doc: fix HTTP req/res 'close' description"

This reverts commit 8ab7ea6.

PR-URL: #21809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
  • Loading branch information
targos committed Aug 1, 2018
1 parent 3d05d82 commit 8799f43
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 32 deletions.
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.

1 comment on commit 8799f43

@mareksrom
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified close event behaviour landed in version 11.0.0 (it is ok:) but I haven't found it in semver-major changes in its changelog... If I don't look a bad way it would be fine to add this information... Thanks

Please sign in to comment.