Skip to content

doc: update http server response 'close' event#34472

Closed
renatomariscal wants to merge 1 commit intonodejs:masterfrom
renatomariscal:renato/documentation
Closed

doc: update http server response 'close' event#34472
renatomariscal wants to merge 1 commit intonodejs:masterfrom
renatomariscal:renato/documentation

Conversation

@renatomariscal
Copy link
Copy Markdown
Contributor

Two places emits close events:

1 - On result completion:

resOnFinish calls emitCloseNT, which happens when the result is completed:

function resOnFinish(req, res, socket, state, server) {

2 - When the connection is terminated

It gets attached once the socket is assigned:

socket.on('close', onServerResponseClose);

And detached if the response is completed:
https://github.com/nodejs/node/blob/master/lib/_http_server.js#L709

ServerResponse.prototype.detachSocket = function detachSocket(socket) {

Which means, it can only be reached in this case, for premature socket termination.

Checklist

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem. labels Jul 22, 2020
@Trott
Copy link
Copy Markdown
Member

Trott commented Jul 23, 2020

@nodejs/http @addaleax @ronag

@renatomariscal renatomariscal requested a review from a team as a code owner August 10, 2020 16:06
@Trott
Copy link
Copy Markdown
Member

Trott commented Aug 11, 2020

Landed in f8a0e62
Thanks for the contribution! 🎉

@Trott Trott closed this Aug 11, 2020
@danielleadams danielleadams mentioned this pull request Aug 20, 2020
@codebytere codebytere mentioned this pull request Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants