Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8799f43

Browse filesBrowse files
committed
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>
1 parent 3d05d82 commit 8799f43
Copy full SHA for 8799f43

File tree

Expand file treeCollapse file tree

3 files changed

+3
-32
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+3
-32
lines changed
Open diff view settings
Collapse file

‎doc/api/http.md‎

Copy file name to clipboardExpand all lines: doc/api/http.md
+3-1Lines changed: 3 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,8 @@ interface. This is an [`EventEmitter`][] with the following events:
10151015
added: v0.6.7
10161016
-->
10171017

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

10201021
### Event: 'finish'
10211022
<!-- YAML
@@ -1505,6 +1506,7 @@ added: v0.4.2
15051506
-->
15061507

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

15091511
### message.aborted
15101512
<!-- YAML
Collapse file

‎lib/_http_server.js‎

Copy file name to clipboardExpand all lines: lib/_http_server.js
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,6 @@ function resOnFinish(req, res, socket, state, server) {
561561
req._dump();
562562

563563
res.detachSocket(socket);
564-
req.emit('close');
565-
process.nextTick(emitCloseNT, res);
566564

567565
if (res._last) {
568566
if (typeof socket.destroySoon === 'function') {
@@ -585,10 +583,6 @@ function resOnFinish(req, res, socket, state, server) {
585583
}
586584
}
587585

588-
function emitCloseNT(self) {
589-
self.emit('close');
590-
}
591-
592586
// The following callback is issued after the headers have been read on a
593587
// new message. In this callback we setup the response object and pass it
594588
// to the user.
Collapse file

‎test/parallel/test-http-req-res-close.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-req-res-close.js
-25Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.