From d29b80556942ca7341b75bc9a3b00191d9997ac4 Mon Sep 17 00:00:00 2001 From: Renato Mariscal Date: Tue, 21 Jul 2020 16:28:33 -0700 Subject: [PATCH] doc: update http server response 'close' event Two places emits `close` events: `resOnFinish` calls `emitCloseNT`, which happens when the result is completed: https://github.com/nodejs/node/blob/687dbd85263f433cc351c6daa83f9296a1d0bb4f/lib/_http_server.js#L695 It gets attached once the socket is assigned: https://github.com/nodejs/node/blob/687dbd85263f433cc351c6daa83f9296a1d0bb4f/lib/_http_server.js#L226 And detached if the response is completed: https://github.com/nodejs/node/blob/master/lib/_http_server.js#L709 https://github.com/nodejs/node/blob/687dbd85263f433cc351c6daa83f9296a1d0bb4f/lib/_http_server.js#L232 Which means, it can only be reached in this case, for premature socket termination. PR-URL: https://github.com/nodejs/node/pull/34472 Reviewed-By: James M Snell Reviewed-By: Robert Nagy Reviewed-By: Rich Trott --- doc/api/http.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/http.md b/doc/api/http.md index fa60f0c9687cf5..d118acdf3668b9 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -1335,7 +1335,8 @@ passed as the second parameter to the [`'request'`][] event. added: v0.6.7 --> -Indicates that the underlying connection was terminated. +Indicates that the the response is completed, or its underlying connection was +terminated prematurely (before the response completion). ### Event: `'finish'`