diff options
author | Robert Nagy <ronagy@icloud.com> | 2017-09-24 20:27:44 +0200 |
---|---|---|
committer | Matteo Collina <hello@matteocollina.com> | 2017-10-18 15:56:19 +0200 |
commit | 5d99a9bf65258406c5ad0566842c62d421fab09a (patch) | |
tree | ba3a6270381c20a6c9cf966eea120e83708c28e3 /lib/_http_client.js | |
parent | df5dc2da39f8cd043e51ebdf4f81ee243ba8bb45 (diff) | |
download | android-node-v8-5d99a9bf65258406c5ad0566842c62d421fab09a.tar.gz android-node-v8-5d99a9bf65258406c5ad0566842c62d421fab09a.tar.bz2 android-node-v8-5d99a9bf65258406c5ad0566842c62d421fab09a.zip |
http: emit close as the last event in the client
Emit close event after all other events in the client, e.g.
error will be emitted before close.
PR-URL: https://github.com/nodejs/node/pull/15588
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'lib/_http_client.js')
-rw-r--r-- | lib/_http_client.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/_http_client.js b/lib/_http_client.js index 1efdd0f53b..e036522d7b 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -346,7 +346,6 @@ function socketCloseListener() { // NOTE: It's important to get parser here, because it could be freed by // the `socketOnData`. var parser = socket.parser; - req.emit('close'); if (req.res && req.res.readable) { // Socket closed before we emitted 'end' below. req.res.emit('aborted'); @@ -362,6 +361,7 @@ function socketCloseListener() { req.socket._hadError = true; req.emit('error', createHangUpError()); } + req.emit('close'); // Too bad. That output wasn't getting written. // This is pretty terrible that it doesn't raise an error. |