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, ); }