From 2798379edf31e7adf1767cf3f173ebd20dd508fa Mon Sep 17 00:00:00 2001 From: Alistair Smith Date: Fri, 9 May 2025 14:57:52 -0700 Subject: [PATCH] net changes, ERR_TLS_PROTOCOL_VERSION_CONFLICT fix message --- src/js/node/net.ts | 11 +++++++---- src/js/node/tls.ts | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/js/node/net.ts b/src/js/node/net.ts index f7190c516e..f080e0a336 100644 --- a/src/js/node/net.ts +++ b/src/js/node/net.ts @@ -350,12 +350,12 @@ const ServerHandlers: SocketHandler = { const self = this.data; socket[kServerSocket] = self._handle; const options = self[bunSocketServerOptions]; + const { pauseOnConnect, connectionListener, [kSocketClass]: SClass, requestCert, rejectUnauthorized } = options; - const _socket = new SClass({ - minVersion: self.minVersion, - maxVersion: self.maxVersion, - }); + console.log(options); + + const _socket = new SClass(options); _socket.isServer = true; _socket.server = self; @@ -1453,6 +1453,9 @@ Server.prototype.listen = function listen(port, hostname, onListen) { if (typeof bunTLS === "function") { [tls, TLSSocketClass] = bunTLS.$call(this, port, hostname, false); options.servername = tls.serverName; + options.minVersion = tls.minVersion; + options.maxVersion = tls.maxVersion; + options[kSocketClass] = TLSSocketClass; contexts = tls.contexts; if (!tls.requestCert) { diff --git a/src/js/node/tls.ts b/src/js/node/tls.ts index 4cf743ca86..dd22e8a89c 100644 --- a/src/js/node/tls.ts +++ b/src/js/node/tls.ts @@ -336,8 +336,8 @@ var InternalSecureContext = class SecureContext { if (hasSecureProtocol && (hasMinVersionOption || hasMaxVersionOption)) { throw $ERR_TLS_PROTOCOL_VERSION_CONFLICT( - "options.secureProtocol", - hasMinVersionOption ? "options.minVersion" : "options.maxVersion", + TLS_VERSION_REVERSE_MAP[hasMinVersionOption ? options.minVersion : options.maxVersion], + secureProtocol, ); } @@ -658,8 +658,8 @@ function Server(options, secureConnectionListener): void { if (hasSecureProtocol && (hasMinVersionOption || hasMaxVersionOption)) { throw $ERR_TLS_PROTOCOL_VERSION_CONFLICT( - "options.secureProtocol", - hasMinVersionOption ? "options.minVersion" : "options.maxVersion", + TLS_VERSION_REVERSE_MAP[hasMinVersionOption ? options.minVersion : options.maxVersion], + secureProtocol, ); }