mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 03:54:24 +01:00
Include HTTP_PROXY and NO_PROXY (#93595)
This commit is contained in:
@@ -119,6 +119,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
private readonly touchBarGroups: TouchBarSegmentedControl[];
|
||||
|
||||
private currentHttpProxy?: string;
|
||||
private currentNoProxy?: string;
|
||||
|
||||
constructor(
|
||||
config: IWindowCreationOptions,
|
||||
@@ -597,12 +598,17 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
this.setMenuBarVisibility(newMenuBarVisibility);
|
||||
}
|
||||
// Do not set to empty configuration at startup if setting is empty to not override configuration through CLI options:
|
||||
const newHttpProxy = (this.configurationService.getValue<string>('http.proxy') || '').trim() || undefined;
|
||||
if (newHttpProxy !== this.currentHttpProxy) {
|
||||
const env = process.env;
|
||||
const newHttpProxy = (this.configurationService.getValue<string>('http.proxy') || '').trim()
|
||||
|| (env.https_proxy || process.env.HTTPS_PROXY || process.env.http_proxy || process.env.HTTP_PROXY || '').trim() // Not standardized.
|
||||
|| undefined;
|
||||
const newNoProxy = (env.no_proxy || env.NO_PROXY || '').trim() || undefined; // Not standardized.
|
||||
if (newHttpProxy !== this.currentHttpProxy || newNoProxy !== this.currentNoProxy) {
|
||||
this.currentHttpProxy = newHttpProxy;
|
||||
this.currentNoProxy = newNoProxy;
|
||||
this._win.webContents.session.setProxy({
|
||||
proxyRules: newHttpProxy || '',
|
||||
proxyBypassRules: '',
|
||||
proxyBypassRules: newNoProxy ? `${newNoProxy},<local>` : '<local>',
|
||||
pacScript: '',
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user