From 66ff28c21eac7f0cca0d3ccf141b1dc4cafa4888 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 18 Jan 2024 22:24:02 +0530 Subject: fix(node): update `req.socket` on WS upgrade (#21984) Update the `req.socket` to be a `net.Socket` from `FakeSocket` Fixes #21979 --- ext/node/polyfills/http.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ext') diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index fe5896534..9356dde0a 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -1637,6 +1637,8 @@ export class ServerImpl extends EventEmitter { const socket = new Socket({ handle: new TCP(constants.SERVER, conn), }); + // Update socket held by `req`. + req.socket = socket; this.emit("upgrade", req, socket, Buffer.from([])); return response; } else { -- cgit v1.2.3