test kerberos import

chrmarti/rising-tuna
Christof Marti 2024-11-22 15:53:53 +01:00
parent d8d0ddba9c
commit 5cf2c74197
No known key found for this signature in database
GPG Key ID: 0ACE6CC184995A83
1 changed files with 26 additions and 1 deletions

View File

@ -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<string>('proxyKerberosServicePrincipal')
|| (process.platform === 'win32' ? `HTTP/${url.hostname}` : `HTTP@${url.hostname}`);