Skip to content

Commit

Permalink
Keep originals and resolveProxyURL (#228697)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed Nov 29, 2024
1 parent 9fa0171 commit 09f117f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/vs/workbench/api/node/proxyResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type * as undiciType from 'undici-types';
import type * as tlsType from 'tls';
import type * as streamType from 'stream';
import { lookupKerberosAuthorization } from '../../../platform/request/node/requestService.js';
import * as proxyAgent from '@vscode/proxy-agent';

const require = createRequire(import.meta.url);
const http = require('http');
Expand Down Expand Up @@ -90,6 +91,8 @@ export function connectProxyResolver(
env: process.env,
};
const { resolveProxyWithRequest, resolveProxyURL } = createProxyResolver(params);
const target = (proxyAgent as any).default || proxyAgent;
target.resolveProxyURL = resolveProxyURL;

patchGlobalFetch(configProvider, mainThreadTelemetry, initData, resolveProxyURL, params.lookupProxyAuthorization!, getOrLoadAdditionalCertificates.bind(undefined, params), disposables);

Expand Down Expand Up @@ -348,7 +351,9 @@ function recordFetchFeatureUse(mainThreadTelemetry: MainThreadTelemetryShape, fe
function createPatchedModules(params: ProxyAgentParams, resolveProxy: ResolveProxyWithRequest) {

function mergeModules(module: any, patch: any) {
return Object.assign(module.default || module, patch);
const target = module.default || module;
target.__vscodeOriginal = Object.assign({}, target);
return Object.assign(target, patch);
}

return {
Expand Down

0 comments on commit 09f117f

Please sign in to comment.