From ca5d3d8195edfcb4344efaafedfa8a8b283a87d0 Mon Sep 17 00:00:00 2001 From: dnwpark Date: Thu, 28 Nov 2024 21:27:12 -0500 Subject: [PATCH] test --- packages/driver/src/baseClient.ts | 3 +++ packages/driver/src/browserClient.ts | 3 +++ packages/driver/src/conUtils.ts | 39 +++++++++++++++++++++++++++- packages/driver/src/httpScram.ts | 2 ++ packages/driver/src/nodeClient.ts | 4 +++ 5 files changed, 50 insertions(+), 1 deletion(-) diff --git a/packages/driver/src/baseClient.ts b/packages/driver/src/baseClient.ts index b25ae7e91..6660979f6 100644 --- a/packages/driver/src/baseClient.ts +++ b/packages/driver/src/baseClient.ts @@ -431,7 +431,10 @@ export abstract class BaseClientPool { throw new errors.InterfaceError("The client is closed"); } + console.log("! getNewConnection"); + console.log(this.__normalizedConnectConfig); const config = await this._getNormalizedConnectConfig(); + console.log(config.connectionParams); const connection = await retryingConnect( this._connectWithTimeout, config, diff --git a/packages/driver/src/browserClient.ts b/packages/driver/src/browserClient.ts index 901fd7014..1264a7482 100644 --- a/packages/driver/src/browserClient.ts +++ b/packages/driver/src/browserClient.ts @@ -24,6 +24,9 @@ export function createClient(): Client { export function createHttpClient( options?: string | ConnectOptions | null, ): Client { + console.log("! createHttpClient"); + console.log(". options"); + console.log(options); return new Client( new FetchClientPool( parseConnectArguments, diff --git a/packages/driver/src/conUtils.ts b/packages/driver/src/conUtils.ts index 79fae0d4f..97a1bd8b9 100644 --- a/packages/driver/src/conUtils.ts +++ b/packages/driver/src/conUtils.ts @@ -534,6 +534,13 @@ async function parseConnectDsnAndArgs( config: ConnectConfig, serverUtils: ServerUtils | null, ): Promise { + console.log("! parseConnectDsnAndArgs"); + console.log(". config.tlsCA"); + console.log(config.tlsCA); + console.log(". config.tlsCAFile"); + console.log(config.tlsCAFile); + console.log(getEnv("EDGEDB_TLS_CA_FILE")); + const resolvedConfig = new ResolvedConnectConfig(); let fromEnv = false; let fromProject = false; @@ -805,6 +812,9 @@ async function resolveConfigOptions< } } + console.warn("! resolveConfigOptions"); + console.log(". resolvedConfig._tlsCAData"); + console.log(resolvedConfig._tlsCAData); anyOptionsUsed = resolvedConfig.setUser(config.user ?? null, sources.user!) || anyOptionsUsed; @@ -819,15 +829,32 @@ async function resolveConfigOptions< config.cloudProfile ?? null, sources.cloudProfile!, ) || anyOptionsUsed; + console.log(": 1"); + console.log(". resolvedConfig._tlsCAData"); + console.log(resolvedConfig._tlsCAData); + console.log(". config.tlsCAFile"); + console.log(config.tlsCA); + console.log(". sources.tlsCA"); + console.log(sources.tlsCA); anyOptionsUsed = resolvedConfig.setTlsCAData(config.tlsCA ?? null, sources.tlsCA!) || anyOptionsUsed; + console.log(": 2"); + console.log(". resolvedConfig._tlsCAData"); + console.log(resolvedConfig._tlsCAData); + console.log(". config.tlsCAFile"); + console.log(config.tlsCAFile); + console.log(". sources.tlsCAFile"); + console.log(sources.tlsCAFile); anyOptionsUsed = (await resolvedConfig.setTlsCAFile( config.tlsCAFile ?? null, sources.tlsCAFile!, readFile, )) || anyOptionsUsed; + console.log(": 3"); + console.log(". resolvedConfig._tlsCAData"); + console.log(resolvedConfig._tlsCAData); anyOptionsUsed = resolvedConfig.setTlsServerName( config.tlsServerName ?? null, @@ -869,8 +896,11 @@ async function resolveConfigOptions< resolvedConfig.setPort(config.port, sources.port!); } const host = config.host != null ? validateHost(config.host) : ""; - dsn = `edgedb://${host.includes(":") ? `[${encodeURI(host)}]` : host}`; + dsn = `gel://${host.includes(":") ? `[${encodeURI(host)}]` : host}`; } + console.log(": 4"); + console.log(". resolvedConfig._tlsCAData"); + console.log(resolvedConfig._tlsCAData); await parseDSNIntoConfig( dsn, resolvedConfig, @@ -972,6 +1002,11 @@ async function parseDSNIntoConfig( ); } + console.log("!!! parseDSNIntoConfig"); + console.log(". dsnString"); + console.log(dsnString); + console.log(". _tlsCAData"); + console.log(config._tlsCAData); let parsed: URL; try { parsed = new URL(dsnString); @@ -1125,6 +1160,8 @@ async function parseDSNIntoConfig( config.setSecretKey, ); + console.log(". _tlsCAData"); + console.log(config._tlsCAData); await handleDSNPart("tls_ca", null, config._tlsCAData, config.setTlsCAData); await handleDSNPart( "tls_ca_file", diff --git a/packages/driver/src/httpScram.ts b/packages/driver/src/httpScram.ts index ef87f4f29..b3b4cacaa 100644 --- a/packages/driver/src/httpScram.ts +++ b/packages/driver/src/httpScram.ts @@ -88,6 +88,8 @@ export function getHTTPSCRAMAuth(cryptoUtils: CryptoUtils): HttpSCRAMAuth { serverNonce, ); + console.log("!!! getHTTPSCRAMAuth"); + console.log(authUrl); const serverFinalRes = await fetch(authUrl, { headers: { Authorization: `SCRAM-SHA-256 sid=${sid}, data=${utf8ToB64( diff --git a/packages/driver/src/nodeClient.ts b/packages/driver/src/nodeClient.ts index 74a0be3a4..aec09203f 100644 --- a/packages/driver/src/nodeClient.ts +++ b/packages/driver/src/nodeClient.ts @@ -12,6 +12,9 @@ class ClientPool extends BaseClientPool { } export function createClient(options?: string | ConnectOptions | null): Client { + console.log("! createClient"); + console.log(". options"); + console.log(options); return new Client( new ClientPool( parseConnectArguments, @@ -31,6 +34,7 @@ class FetchClientPool extends BaseClientPool { export function createHttpClient( options?: string | ConnectOptions | null, ): Client { + console.log("! createHttpClient"); return new Client( new FetchClientPool( parseConnectArguments,