Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IncomingMessage docs incorrect #41011

Closed
ronag opened this issue Nov 29, 2021 · 0 comments · Fixed by #41014
Closed

IncomingMessage docs incorrect #41011

ronag opened this issue Nov 29, 2021 · 0 comments · Fixed by #41014
Labels
doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. http Issues or PRs related to the http subsystem.

Comments

@ronag
Copy link
Member

ronag commented Nov 29, 2021

nodejs/undici#1115

We have missed updating the docs.

This property is guaranteed to be an instance of the <net.Socket> class, a subclass of <stream.Duplex>, unless the user specified a socket type other than <net.Socket>.

Is no longer true. It will be null after detach and destroy.

node/lib/_http_server.js

Lines 246 to 250 in 265a47d

ServerResponse.prototype.detachSocket = function detachSocket(socket) {
assert(socket._httpMessage === this);
socket.removeListener('close', onServerResponseClose);
socket._httpMessage = null;
this.socket = null;

node/lib/_http_client.js

Lines 661 to 666 in 265a47d

req.destroyed = true;
if (req.res) {
// Detach socket from IncomingMessage to avoid destroying the freed
// socket in IncomingMessage.destroy().
req.res.socket = null;
}

if (isServerRequest(stream)) {
stream.socket = null;
stream.destroy(err);

@ronag ronag added http Issues or PRs related to the http subsystem. doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. labels Nov 29, 2021
lpinca added a commit to lpinca/node that referenced this issue Nov 29, 2021
The `socket` property of the `IncomingMessage` object is nulled on the
server after calling `message.destroy()` and on the client after a
request completes and the socket is kept alive.

Fixes: nodejs#41011
nodejs-github-bot pushed a commit that referenced this issue Dec 1, 2021
The `socket` property of the `IncomingMessage` object is nulled on the
server after calling `message.destroy()` and on the client after a
request completes and the socket is kept alive.

Fixes: #41011

PR-URL: #41014
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
danielleadams pushed a commit that referenced this issue Dec 13, 2021
The `socket` property of the `IncomingMessage` object is nulled on the
server after calling `message.destroy()` and on the client after a
request completes and the socket is kept alive.

Fixes: #41011

PR-URL: #41014
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
danielleadams pushed a commit that referenced this issue Dec 14, 2021
The `socket` property of the `IncomingMessage` object is nulled on the
server after calling `message.destroy()` and on the client after a
request completes and the socket is kept alive.

Fixes: #41011

PR-URL: #41014
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
danielleadams pushed a commit that referenced this issue Jan 31, 2022
The `socket` property of the `IncomingMessage` object is nulled on the
server after calling `message.destroy()` and on the client after a
request completes and the socket is kept alive.

Fixes: #41011

PR-URL: #41014
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Jan 31, 2022
The `socket` property of the `IncomingMessage` object is nulled on the
server after calling `message.destroy()` and on the client after a
request completes and the socket is kept alive.

Fixes: nodejs#41011

PR-URL: nodejs#41014
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
danielleadams pushed a commit that referenced this issue Feb 1, 2022
The `socket` property of the `IncomingMessage` object is nulled on the
server after calling `message.destroy()` and on the client after a
request completes and the socket is kept alive.

Fixes: #41011

PR-URL: #41014
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
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. good first issue Issues that are suitable for first-time contributors. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant