★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/8799f43fb0Nouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files

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

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 Jul 14, 2018
1 parent 3d05d82 commit 8799f43fb0626d4453f7ff7d9d20d4075adf7784
Showing with 3 additions and 32 deletions.
  1. +3 −1 doc/api/http.md
  2. +0 −6 lib/_http_server.js
  3. +0 −25 test/parallel/test-http-req-res-close.js
@@ -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
@@ -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
@@ -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') {
@@ -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.

This file was deleted.

Oops, something went wrong.

1 comment on commit 8799f43

@mareksrom

This comment has been minimized.

Copy link

mareksrom commented on 8799f43 Oct 24, 2018

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.
You can’t perform that action at this time.