From 5cf2c7419780a5313f7f627572a5d81fb5016d24 Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Fri, 22 Nov 2024 15:53:53 +0100 Subject: [PATCH] test kerberos import --- src/vs/workbench/api/node/proxyResolver.ts | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/node/proxyResolver.ts b/src/vs/workbench/api/node/proxyResolver.ts index 8378d4fb98a..672ccc7c65b 100644 --- a/src/vs/workbench/api/node/proxyResolver.ts +++ b/src/vs/workbench/api/node/proxyResolver.ts @@ -38,6 +38,9 @@ export function connectProxyResolver( initData: IExtensionHostInitData, disposables: DisposableStore, ) { + if (extHostLogService.getLevel() === LogServiceLevel.Trace) { + testKerberosImport(extHostLogService); + } const useHostProxy = initData.environment.useHostProxy; const doUseHostProxy = typeof useHostProxy === 'boolean' ? useHostProxy : !initData.remote.isRemote; @@ -96,6 +99,27 @@ export function connectProxyResolver( return configureModuleLoading(extensionService, lookup); } +function testKerberosImport(extHostLogService: ILogService) { + (async () => { + try { + const importKerberos = await import('kerberos'); + const importType = typeof importKerberos; + extHostLogService.trace('ProxyResolver#testKerberosImport Kerberos import type', importType); + if (importKerberos && importType === 'object') { + const importDefault = importKerberos.default; + const importDefaultType = typeof importDefault; + extHostLogService.trace('ProxyResolver#testKerberosImport Kerberos import.default type', importDefaultType); + if (importDefault && importDefaultType === 'object') { + extHostLogService.trace('ProxyResolver#testKerberosImport Kerberos import.default.initializeClient type', typeof importDefault.initializeClient); + } + extHostLogService.trace('ProxyResolver#testKerberosImport Kerberos import.initializeClient type', typeof importKerberos.initializeClient); + } + } catch (err) { + extHostLogService.trace('ProxyResolver#testKerberosImport Kerberos import failed', err); + } + })(); +} + const unsafeHeaders = [ 'content-length', 'host', @@ -480,7 +504,8 @@ async function lookupProxyAuthorization( state.kerberosRequested = true; try { - const kerberos = await import('kerberos'); + const importKerberos = await import('kerberos'); + const kerberos = importKerberos.default || importKerberos; const url = new URL(proxyURL); const spn = configProvider.getConfiguration('http').get('proxyKerberosServicePrincipal') || (process.platform === 'win32' ? `HTTP/${url.hostname}` : `HTTP@${url.hostname}`);