Skip to content

Commit 561451f

Browse files
committed
useHostProxy > isUseHostProxyEnabled() (microsoft/vscode-copilot-release#3821)
1 parent b1f8f2e commit 561451f

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change Log
22
Notable changes will be documented here.
33

4+
## [0.30.0]
5+
- useHostProxy > isUseHostProxyEnabled() ([microsoft/vscode-copilot-release#3821](https://github.com/microsoft/vscode-copilot-release/issues/3821))
6+
47
## [0.29.0]
58
- Update to undici 7.2.0 ([microsoft/vscode-proxy-agent#57](https://github.com/microsoft/vscode-proxy-agent/pull/57))
69
- Get options from unpatched agents ([microsoft/vscode-proxy-agent#58](https://github.com/microsoft/vscode-proxy-agent/pull/58))

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vscode/proxy-agent",
3-
"version": "0.29.0",
3+
"version": "0.30.0",
44
"description": "NodeJS http(s) agent implementation for VS Code",
55
"main": "out/index.js",
66
"types": "out/index.d.ts",

src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export interface ProxyAgentParams {
7474
log: Log;
7575
getLogLevel(): LogLevel;
7676
proxyResolveTelemetry(event: ProxyResolveEvent): void;
77-
useHostProxy: boolean;
77+
isUseHostProxyEnabled: () => boolean;
7878
env: NodeJS.ProcessEnv;
7979
}
8080

@@ -195,6 +195,12 @@ export function createProxyResolver(params: ProxyAgentParams) {
195195
return;
196196
}
197197

198+
if (!params.isUseHostProxyEnabled()) {
199+
callback('DIRECT');
200+
log.debug('ProxyResolver#resolveProxy unconfigured', url, 'DIRECT', stackText);
201+
return;
202+
}
203+
198204
const key = getCacheKey(parsedUrl);
199205
const proxy = getCachedProxy(key);
200206
if (proxy) {
@@ -207,12 +213,6 @@ export function createProxyResolver(params: ProxyAgentParams) {
207213
return;
208214
}
209215

210-
if (!params.useHostProxy) {
211-
callback('DIRECT');
212-
log.debug('ProxyResolver#resolveProxy unconfigured', url, 'DIRECT', stackText);
213-
return;
214-
}
215-
216216
const start = Date.now();
217217
params.resolveProxy(url) // Use full URL to ensure it is an actually used one.
218218
.then(proxy => {

tests/test-client/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const directProxyAgentParams: vpa.ProxyAgentParams = {
2424
log: console,
2525
getLogLevel: () => vpa.LogLevel.Trace,
2626
proxyResolveTelemetry: () => undefined,
27-
useHostProxy: true,
27+
isUseHostProxyEnabled: () => true,
2828
loadAdditionalCertificates: async () => [
2929
...await loadSystemCertificates({ log: console }),
3030
...ca,

0 commit comments

Comments
 (0)