Skip to content

Commit 636a32c

Browse files
Add server name for SNI server name indication TLS extension
1 parent 18d27d0 commit 636a32c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/drivers/connection-tls.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,15 @@ export class SQLiteCloudTlsConnection extends SQLiteCloudConnection {
6363
// connect to plain socket, without encryption, only if insecure parameter specified
6464
// this option is mainly for testing purposes and is not available on production nodes
6565
// which would need to connect using tls and proper certificates as per code below
66-
const connectionOptions: net.SocketConnectOpts = {
66+
const connectionOptions = {
6767
host: config.host,
68-
port: config.port as number
68+
port: config.port as number,
69+
// Server name for the SNI (Server Name Indication) TLS extension.
70+
// https://r2.nodejs.org/docs/v6.11.4/api/tls.html#tls_class_tls_tlssocket
71+
servername: config.host,
72+
rejectUnauthorized: false
6973
}
74+
7075
this.socket = net.connect(connectionOptions, () => {
7176
console.warn(`TlsConnection.connectTransport - connected to ${config.host as string}:${config.port as number} using insecure protocol`)
7277
// send initialization commands

0 commit comments

Comments
 (0)