From cd260d6f7344dca072c0e1159e9113c5439af8ef Mon Sep 17 00:00:00 2001 From: gjsjohnmurray Date: Mon, 8 Sep 2025 17:08:13 +0100 Subject: [PATCH] Respect `http.rejectUnauthorized` setting --- src/extension.ts | 1 + src/ls/driver.ts | 4 ++-- src/ls/irisdb.ts | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 8337b02..3deaa00 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -159,6 +159,7 @@ export async function activate(extContext: ExtensionContext): Promise im this.showSystem = this.credentials.showSystem || false; this.filter = this.credentials.filter || ""; - let { https, server: host, port, pathPrefix, username, password, resultSetRowLimit } = this.credentials; + let { https, server: host, port, pathPrefix, username, password, resultSetRowLimit, rejectUnauthorized } = this.credentials; config = { https, host, @@ -39,7 +39,7 @@ export default class IRISDriver extends AbstractDriver im }; this.resultSetRowLimit = resultSetRowLimit; - const irisdb = new IRISdb(config, resultSetRowLimit); + const irisdb = new IRISdb(config, resultSetRowLimit, rejectUnauthorized); return irisdb.open() .then(() => { this.connection = Promise.resolve(irisdb); diff --git a/src/ls/irisdb.ts b/src/ls/irisdb.ts index f0d694b..100cfb3 100644 --- a/src/ls/irisdb.ts +++ b/src/ls/irisdb.ts @@ -27,6 +27,7 @@ export default class IRISdb { private config: IRISDirect; private resultSetRowLimit: number; + private rejectUnauthorized: boolean; private cookies: string[] = []; private _apiVersion = 1; @@ -34,10 +35,11 @@ export default class IRISdb { return this._apiVersion; } - public constructor(config: IRISDirect, resultSetRowLimit: number) { + public constructor(config: IRISDirect, resultSetRowLimit: number, rejectUnauthorized: boolean = true) { this.config = config; this.config.namespace = this.config.namespace.toUpperCase(); this.resultSetRowLimit = resultSetRowLimit; + this.rejectUnauthorized = rejectUnauthorized; } public updateCookies(newCookies: string[]): void { @@ -99,7 +101,7 @@ export default class IRISdb { const agent = new (https ? httpsModule : httpModule).Agent({ keepAlive: true, maxSockets: 10, - rejectUnauthorized: https, + rejectUnauthorized: this.rejectUnauthorized, }); path = encodeURI(`${pathPrefix || ""}/api/atelier/${path || ""}${buildParams()}`);