File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
src/vs/platform/request/node Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change 55
66import { parse as parseUrl , Url } from 'url' ;
77import { isBoolean } from '../../../base/common/types.js' ;
8+ import { createProxyResolver } from '@vscode/proxy-agent' ;
89
910export type Agent = any ;
1011
11- function getSystemProxyURI ( requestURL : Url , env : typeof process . env ) : string | null {
12- if ( requestURL . protocol === 'http:' ) {
13- return env . HTTP_PROXY || env . http_proxy || null ;
14- } else if ( requestURL . protocol === 'https:' ) {
15- return env . HTTPS_PROXY || env . https_proxy || env . HTTP_PROXY || env . http_proxy || null ;
16- }
17-
18- return null ;
19- }
20-
2112export interface IOptions {
2213 proxyUrl ?: string ;
2314 strictSSL ?: boolean ;
2415}
2516
2617export async function getProxyAgent ( rawRequestURL : string , env : typeof process . env , options : IOptions = { } ) : Promise < Agent > {
27- const requestURL = parseUrl ( rawRequestURL ) ;
28- const proxyURL = options . proxyUrl || getSystemProxyURI ( requestURL , env ) ;
18+ const { resolveProxyURL } = createProxyResolver ( {
19+ getProxyURL : ( ) => {
20+ return options . proxyUrl
21+ }
22+ } ) ;
2923
24+ const proxyURL = await resolveProxyURL ( rawRequestURL )
3025 if ( ! proxyURL ) {
3126 return null ;
3227 }
You can’t perform that action at this time.
0 commit comments