From 2979721e1c1dbe9327556f92d5dbefd5c0d3da19 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Thu, 1 Oct 2020 10:43:13 +0200 Subject: [PATCH] doc: avoid using deprecated connection property `request.connection` and `response.connection` are deprecated. Use `request.socket` and `response.socket` instead. PR-URL: https://github.com/nodejs/node/pull/35439 Reviewed-By: Anna Henningsen Reviewed-By: Pranshu Srivastava Reviewed-By: Harshitha K P Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat --- doc/api/http.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/api/http.md b/doc/api/http.md index 3e140dab9611cd..640fb041dd0de3 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -926,8 +926,7 @@ added: v0.3.0 Reference to the underlying socket. Usually users will not want to access this property. In particular, the socket will not emit `'readable'` events -because of how the protocol parser attaches to the socket. The `socket` -may also be accessed via `request.connection`. +because of how the protocol parser attaches to the socket. ```js const http = require('http'); @@ -1157,7 +1156,7 @@ This event is emitted when a new TCP stream is established. `socket` is typically an object of type [`net.Socket`][]. Usually users will not want to access this event. In particular, the socket will not emit `'readable'` events because of how the protocol parser attaches to the socket. The `socket` can -also be accessed at `request.connection`. +also be accessed at `request.socket`. This event can also be explicitly emitted by users to inject connections into the HTTP server. In that case, any [`Duplex`][] stream can be passed. @@ -1658,8 +1657,7 @@ added: v0.3.0 Reference to the underlying socket. Usually users will not want to access this property. In particular, the socket will not emit `'readable'` events because of how the protocol parser attaches to the socket. After -`response.end()`, the property is nulled. The `socket` may also be accessed -via `response.connection`. +`response.end()`, the property is nulled. ```js const http = require('http'); @@ -2059,7 +2057,7 @@ added: v0.5.9 * `callback` {Function} * Returns: {http.IncomingMessage} -Calls `message.connection.setTimeout(msecs, callback)`. +Calls `message.socket.setTimeout(msecs, callback)`. ### `message.socket`