Skip to content

Commit 5643f8c

Browse files
When non linearizable is set, it can be the first command upon connection
1 parent 2abe6cc commit 5643f8c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/drivers/connection-tls.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
import * as tls from 'tls'
2222

2323
/**
24-
* Implementation of SQLiteCloudConnection that connects to the database using specific Bun APIs
24+
* Implementation of SQLiteCloudConnection that connects to the database using specific tls APIs
2525
* that connect to native sockets or tls sockets and communicates via raw, binary protocol.
2626
*/
2727
export class SQLiteCloudTlsConnection extends SQLiteCloudConnection {
@@ -50,7 +50,7 @@ export class SQLiteCloudTlsConnection extends SQLiteCloudConnection {
5050
const connectionOptions = {
5151
host: config.host,
5252
port: config.port as number,
53-
rejectUnauthorized: false,
53+
rejectUnauthorized: true,
5454
// Server name for the SNI (Server Name Indication) TLS extension.
5555
// https://r2.nodejs.org/docs/v6.11.4/api/tls.html#tls_class_tls_tlssocket
5656
servername: config.host

src/drivers/utilities.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export function getInitializationCommands(config: SQLiteCloudConfig): string {
3939
// first user authentication, then all other commands
4040
let commands = ''
4141

42+
if (config.non_linearizable) {
43+
commands += 'SET CLIENT KEY NONLINEARIZABLE TO 1; '
44+
}
45+
4246
if (config.apikey) {
4347
commands = `AUTH APIKEY ${config.apikey}; `
4448
} else {
@@ -57,9 +61,6 @@ export function getInitializationCommands(config: SQLiteCloudConfig): string {
5761
if (config.zerotext) {
5862
commands += 'SET CLIENT KEY ZEROTEXT TO 1; '
5963
}
60-
if (config.non_linearizable) {
61-
commands += 'SET CLIENT KEY NONLINEARIZABLE TO 1; '
62-
}
6364
if (config.noblob) {
6465
commands += 'SET CLIENT KEY NOBLOB TO 1; '
6566
}

0 commit comments

Comments
 (0)