Adopt @vscode/proxy-agent 0.36.0

This commit is contained in:
Christof Marti
2025-11-03 15:26:15 +01:00
parent e3babad841
commit 29bced6a0d
8 changed files with 34 additions and 32 deletions

11
package-lock.json generated
View File

@@ -17,7 +17,7 @@
"@vscode/deviceid": "^0.1.1", "@vscode/deviceid": "^0.1.1",
"@vscode/iconv-lite-umd": "0.7.1", "@vscode/iconv-lite-umd": "0.7.1",
"@vscode/policy-watcher": "^1.3.2", "@vscode/policy-watcher": "^1.3.2",
"@vscode/proxy-agent": "^0.35.0", "@vscode/proxy-agent": "^0.36.0",
"@vscode/ripgrep": "^1.15.13", "@vscode/ripgrep": "^1.15.13",
"@vscode/spdlog": "^0.15.2", "@vscode/spdlog": "^0.15.2",
"@vscode/sqlite3": "5.1.8-vscode", "@vscode/sqlite3": "5.1.8-vscode",
@@ -3016,9 +3016,9 @@
} }
}, },
"node_modules/@vscode/proxy-agent": { "node_modules/@vscode/proxy-agent": {
"version": "0.35.0", "version": "0.36.0",
"resolved": "https://registry.npmjs.org/@vscode/proxy-agent/-/proxy-agent-0.35.0.tgz", "resolved": "https://registry.npmjs.org/@vscode/proxy-agent/-/proxy-agent-0.36.0.tgz",
"integrity": "sha512-25BxUVwWkRVdVKHIekIz5pshmPprkLmtyPteRIhZIKJF++5u1nLETeHO+a+E957UXnH+YiD2Hh9g9DxVnuBRxA==", "integrity": "sha512-W4mls/+zErqTYcKC41utdmoYnBWZRH1dRF9U4cBAyKU5EhcnWfVsPBvUnXXw1CffI3djmMWnu9JrF/Ynw7lkcg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@tootallnate/once": "^3.0.0", "@tootallnate/once": "^3.0.0",
@@ -3029,6 +3029,9 @@
"socks-proxy-agent": "^8.0.1", "socks-proxy-agent": "^8.0.1",
"undici": "^7.2.0" "undici": "^7.2.0"
}, },
"engines": {
"node": ">=22.15.0"
},
"optionalDependencies": { "optionalDependencies": {
"@vscode/windows-ca-certs": "^0.3.1" "@vscode/windows-ca-certs": "^0.3.1"
} }

View File

@@ -79,7 +79,7 @@
"@vscode/deviceid": "^0.1.1", "@vscode/deviceid": "^0.1.1",
"@vscode/iconv-lite-umd": "0.7.1", "@vscode/iconv-lite-umd": "0.7.1",
"@vscode/policy-watcher": "^1.3.2", "@vscode/policy-watcher": "^1.3.2",
"@vscode/proxy-agent": "^0.35.0", "@vscode/proxy-agent": "^0.36.0",
"@vscode/ripgrep": "^1.15.13", "@vscode/ripgrep": "^1.15.13",
"@vscode/spdlog": "^0.15.2", "@vscode/spdlog": "^0.15.2",
"@vscode/sqlite3": "5.1.8-vscode", "@vscode/sqlite3": "5.1.8-vscode",

View File

@@ -13,7 +13,7 @@
"@parcel/watcher": "parcel-bundler/watcher#1ca032aa8339260a8a3bcf825c3a1a71e3e43542", "@parcel/watcher": "parcel-bundler/watcher#1ca032aa8339260a8a3bcf825c3a1a71e3e43542",
"@vscode/deviceid": "^0.1.1", "@vscode/deviceid": "^0.1.1",
"@vscode/iconv-lite-umd": "0.7.1", "@vscode/iconv-lite-umd": "0.7.1",
"@vscode/proxy-agent": "^0.35.0", "@vscode/proxy-agent": "^0.36.0",
"@vscode/ripgrep": "^1.15.13", "@vscode/ripgrep": "^1.15.13",
"@vscode/spdlog": "^0.15.2", "@vscode/spdlog": "^0.15.2",
"@vscode/tree-sitter-wasm": "^0.2.0", "@vscode/tree-sitter-wasm": "^0.2.0",
@@ -134,9 +134,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@vscode/proxy-agent": { "node_modules/@vscode/proxy-agent": {
"version": "0.35.0", "version": "0.36.0",
"resolved": "https://registry.npmjs.org/@vscode/proxy-agent/-/proxy-agent-0.35.0.tgz", "resolved": "https://registry.npmjs.org/@vscode/proxy-agent/-/proxy-agent-0.36.0.tgz",
"integrity": "sha512-25BxUVwWkRVdVKHIekIz5pshmPprkLmtyPteRIhZIKJF++5u1nLETeHO+a+E957UXnH+YiD2Hh9g9DxVnuBRxA==", "integrity": "sha512-W4mls/+zErqTYcKC41utdmoYnBWZRH1dRF9U4cBAyKU5EhcnWfVsPBvUnXXw1CffI3djmMWnu9JrF/Ynw7lkcg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@tootallnate/once": "^3.0.0", "@tootallnate/once": "^3.0.0",
@@ -147,6 +147,9 @@
"socks-proxy-agent": "^8.0.1", "socks-proxy-agent": "^8.0.1",
"undici": "^7.2.0" "undici": "^7.2.0"
}, },
"engines": {
"node": ">=22.15.0"
},
"optionalDependencies": { "optionalDependencies": {
"@vscode/windows-ca-certs": "^0.3.1" "@vscode/windows-ca-certs": "^0.3.1"
} }

View File

@@ -8,7 +8,7 @@
"@parcel/watcher": "parcel-bundler/watcher#1ca032aa8339260a8a3bcf825c3a1a71e3e43542", "@parcel/watcher": "parcel-bundler/watcher#1ca032aa8339260a8a3bcf825c3a1a71e3e43542",
"@vscode/deviceid": "^0.1.1", "@vscode/deviceid": "^0.1.1",
"@vscode/iconv-lite-umd": "0.7.1", "@vscode/iconv-lite-umd": "0.7.1",
"@vscode/proxy-agent": "^0.35.0", "@vscode/proxy-agent": "^0.36.0",
"@vscode/ripgrep": "^1.15.13", "@vscode/ripgrep": "^1.15.13",
"@vscode/spdlog": "^0.15.2", "@vscode/spdlog": "^0.15.2",
"@vscode/tree-sitter-wasm": "^0.2.0", "@vscode/tree-sitter-wasm": "^0.2.0",

View File

@@ -115,6 +115,7 @@ flakySuite('Native Modules (all platforms)', () => {
const proxyAgent = await import('@vscode/proxy-agent'); const proxyAgent = await import('@vscode/proxy-agent');
// This call will load `@vscode/proxy-agent` which is a native module that we want to test on Windows // This call will load `@vscode/proxy-agent` which is a native module that we want to test on Windows
const windowsCerts = await proxyAgent.loadSystemCertificates({ const windowsCerts = await proxyAgent.loadSystemCertificates({
loadSystemCertificatesFromNode: () => undefined,
log: { log: {
trace: () => { }, trace: () => { },
debug: () => { }, debug: () => { },

View File

@@ -264,7 +264,10 @@ function registerProxyConfigurations(useHostProxy = true, useHostProxyDefault =
tags: ['experimental'], tags: ['experimental'],
default: false, default: false,
markdownDescription: localize('systemCertificatesNode', "Controls whether system certificates should be loaded using Node.js built-in support. Reload the window after changing this setting. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.", '`#http.useLocalProxyConfiguration#`'), markdownDescription: localize('systemCertificatesNode', "Controls whether system certificates should be loaded using Node.js built-in support. Reload the window after changing this setting. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.", '`#http.useLocalProxyConfiguration#`'),
restricted: true restricted: true,
experiment: {
mode: 'auto'
}
}, },
'http.experimental.systemCertificatesV2': { 'http.experimental.systemCertificatesV2': {
type: 'boolean', type: 'boolean',

View File

@@ -5,7 +5,6 @@
import type * as http from 'http'; import type * as http from 'http';
import type * as https from 'https'; import type * as https from 'https';
import * as tls from 'tls';
import { parse as parseUrl } from 'url'; import { parse as parseUrl } from 'url';
import { Promises } from '../../../base/common/async.js'; import { Promises } from '../../../base/common/async.js';
import { streamToBufferReadableStream } from '../../../base/common/buffer.js'; import { streamToBufferReadableStream } from '../../../base/common/buffer.js';
@@ -119,15 +118,11 @@ export class RequestService extends AbstractRequestService implements IRequestSe
} }
async loadCertificates(): Promise<string[]> { async loadCertificates(): Promise<string[]> {
const useNodeSystemCerts = this.getConfigValue<boolean>('http.systemCertificatesNode', false);
if (useNodeSystemCerts) {
const start = Date.now();
const systemCerts = tls.getCACertificates('system');
this.logService.trace(`RequestService#loadCertificates: Loaded Node.js system certificates (${Date.now() - start}ms):`, systemCerts.length);
return systemCerts;
}
const proxyAgent = await import('@vscode/proxy-agent'); const proxyAgent = await import('@vscode/proxy-agent');
return proxyAgent.loadSystemCertificates({ log: this.logService }); return proxyAgent.loadSystemCertificates({
loadSystemCertificatesFromNode: () => this.getConfigValue<boolean>('http.systemCertificatesNode', false),
log: this.logService,
});
} }
private getConfigValue<T>(key: string, fallback?: T): T | undefined { private getConfigValue<T>(key: string, fallback?: T): T | undefined {

View File

@@ -54,6 +54,7 @@ export function connectProxyResolver(
isAdditionalFetchSupportEnabled: () => getExtHostConfigValue<boolean>(configProvider, isRemote, 'http.fetchAdditionalSupport', true), isAdditionalFetchSupportEnabled: () => getExtHostConfigValue<boolean>(configProvider, isRemote, 'http.fetchAdditionalSupport', true),
addCertificatesV1: () => certSettingV1(configProvider, isRemote), addCertificatesV1: () => certSettingV1(configProvider, isRemote),
addCertificatesV2: () => certSettingV2(configProvider, isRemote), addCertificatesV2: () => certSettingV2(configProvider, isRemote),
loadSystemCertificatesFromNode: () => getExtHostConfigValue<boolean>(configProvider, isRemote, 'http.systemCertificatesNode', false),
log: extHostLogService, log: extHostLogService,
getLogLevel: () => { getLogLevel: () => {
const level = extHostLogService.getLevel(); const level = extHostLogService.getLevel();
@@ -81,21 +82,17 @@ export function connectProxyResolver(
const useNodeSystemCerts = getExtHostConfigValue<boolean>(configProvider, isRemote, 'http.systemCertificatesNode', false); const useNodeSystemCerts = getExtHostConfigValue<boolean>(configProvider, isRemote, 'http.systemCertificatesNode', false);
const promises: Promise<string[]>[] = []; const promises: Promise<string[]>[] = [];
if (isRemote) { if (isRemote) {
if (useNodeSystemCerts) { promises.push(loadSystemCertificates({
const start = Date.now(); loadSystemCertificatesFromNode: () => useNodeSystemCerts,
const systemCerts = tls.getCACertificates('system'); log: extHostLogService,
extHostLogService.trace(`ProxyResolver#loadAdditionalCertificates: Loaded Node.js system certificates (${Date.now() - start}ms):`, systemCerts.length); }));
promises.push(Promise.resolve(systemCerts));
} else {
promises.push(loadSystemCertificates({ log: extHostLogService }));
}
} }
if (loadLocalCertificates) { if (loadLocalCertificates) {
if (!isRemote && useNodeSystemCerts) { if (!isRemote && useNodeSystemCerts) {
const start = Date.now(); promises.push(loadSystemCertificates({
const systemCerts = tls.getCACertificates('system'); loadSystemCertificatesFromNode: () => useNodeSystemCerts,
extHostLogService.trace(`ProxyResolver#loadAdditionalCertificates: Loaded Node.js system certificates (${Date.now() - start}ms):`, systemCerts.length); log: extHostLogService,
promises.push(Promise.resolve(systemCerts)); }));
} else { } else {
extHostLogService.trace('ProxyResolver#loadAdditionalCertificates: Loading certificates from main process'); extHostLogService.trace('ProxyResolver#loadAdditionalCertificates: Loading certificates from main process');
const certs = extHostWorkspace.loadCertificates(); // Loading from main process to share cache. const certs = extHostWorkspace.loadCertificates(); // Loading from main process to share cache.