Skip to content

Commit b0fab82

Browse files
authored
Pick up http.systemCertificatesNode setting (#1767)
1 parent 7a90b70 commit b0fab82

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/extension/log/vscode-node/loggingActions.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ interface ProxyAgentLog {
4747

4848
interface ProxyAgentParams {
4949
log: ProxyAgentLog;
50+
loadSystemCertificatesFromNode: () => boolean | undefined;
5051
}
5152

5253
interface ProxyAgent {
@@ -92,7 +93,8 @@ User Settings:
9293
\`\`\`${getProxyEnvVariables()}
9394
`);
9495
const proxyAgent = loadVSCodeModule<ProxyAgent>('@vscode/proxy-agent');
95-
const osCertificates = proxyAgent?.loadSystemCertificates ? await loadSystemCertificates(proxyAgent.loadSystemCertificates, this.logService) : undefined;
96+
const loadSystemCertificatesFromNode = this.configurationService.getNonExtensionConfig<boolean>('http.systemCertificatesNode');
97+
const osCertificates = proxyAgent?.loadSystemCertificates ? await loadSystemCertificates(proxyAgent.loadSystemCertificates, loadSystemCertificatesFromNode, this.logService) : undefined;
9698
const urls = [
9799
this.capiClientService.dotcomAPIURL,
98100
this.capiClientService.capiPingURL,
@@ -289,7 +291,7 @@ function loadVSCodeModule<T>(moduleName: string): T | undefined {
289291
return undefined;
290292
}
291293

292-
async function loadSystemCertificates(load: NonNullable<ProxyAgent['loadSystemCertificates']>, logService: ILogService): Promise<(string | Buffer)[] | undefined> {
294+
async function loadSystemCertificates(load: NonNullable<ProxyAgent['loadSystemCertificates']>, loadSystemCertificatesFromNode: boolean | undefined, logService: ILogService): Promise<(string | Buffer)[] | undefined> {
293295
try {
294296
const certificates = await load({
295297
log: {
@@ -308,7 +310,8 @@ async function loadSystemCertificates(load: NonNullable<ProxyAgent['loadSystemCe
308310
error(message: string | Error, ..._args: any[]) {
309311
logService.error(typeof message === 'string' ? message : String(message));
310312
},
311-
} satisfies ProxyAgentLog
313+
} satisfies ProxyAgentLog,
314+
loadSystemCertificatesFromNode: () => loadSystemCertificatesFromNode,
312315
});
313316
return Array.isArray(certificates) ? certificates : undefined;
314317
} catch (err) {
@@ -379,6 +382,7 @@ function getNonDefaultSettings() {
379382
'http.proxyKerberosServicePrincipal',
380383
'http.systemCertificates',
381384
'http.experimental.systemCertificatesV2',
385+
'http.systemCertificatesNode',
382386
].map(key => {
383387
const i = configuration.inspect(key);
384388
const v = configuration.get(key, i?.defaultValue);

0 commit comments

Comments
 (0)