Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
renatomariscal committed Jul 22, 2020
commit 00957f2ee33c1d04130d205b0cd035ce9e708da2
3 changes: 2 additions & 1 deletion doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,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'`
<!-- YAML
Expand Down