From 3a4de2eb82a92a350851c8fb6cc8bc83f3b0e43e Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Tue, 29 Oct 2024 22:51:42 +0900 Subject: [PATCH] access to internalRid via kStreamBaseField as it could be swapped to TlsConn in afterConnect of tls.connect --- ext/node/polyfills/http.ts | 6 ++++-- ext/node/polyfills/internal_binding/tcp_wrap.ts | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index feb6ec8c4d..9324ce27c2 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -51,6 +51,7 @@ import { Agent, globalAgent } from "node:_http_agent"; import { urlToHttpOptions } from "ext:deno_node/internal/url.ts"; import { kEmptyObject, once } from "ext:deno_node/internal/util.mjs"; import { constants, TCP } from "ext:deno_node/internal_binding/tcp_wrap.ts"; +import { kStreamBaseField } from "ext:deno_node/internal_binding/stream_wrap.ts"; import { notImplemented } from "ext:deno_node/_utils.ts"; import { isWindows } from "ext:deno_node/_util/os.ts"; import { @@ -453,10 +454,11 @@ class ClientRequest extends OutgoingMessage { (async () => { try { const parsedUrl = new URL(url); - let baseConnRid = this.socket._handle[internalRidSymbol]; + let baseConnRid = + this.socket._handle[kStreamBaseField][internalRidSymbol]; if (this._encrypted && !this.socket.authorized) { [baseConnRid] = op_tls_start({ - rid: this.socket._handle[internalRidSymbol], + rid: baseConnRid, hostname: parsedUrl.hostname, caCerts: [], alpnProtocols: ["http/1.0", "http/1.1"], diff --git a/ext/node/polyfills/internal_binding/tcp_wrap.ts b/ext/node/polyfills/internal_binding/tcp_wrap.ts index 2575d517e3..9e9b733cfb 100644 --- a/ext/node/polyfills/internal_binding/tcp_wrap.ts +++ b/ext/node/polyfills/internal_binding/tcp_wrap.ts @@ -385,7 +385,6 @@ export class TCP extends ConnectionWrap { this.#address = req.localAddress = localAddr.hostname; this.#port = req.localPort = localAddr.port; this[kStreamBaseField] = conn; - this[internalRidSymbol] = conn[internalRidSymbol]; try { this.afterConnect(req, 0);