Pass Http proxy URL and strict SSL flag to backend STS (#24550)

This commit is contained in:
Cheena Malhotra
2023-10-11 19:50:07 -07:00
committed by GitHub
parent 989193645c
commit aaa9c4a744
3 changed files with 31 additions and 0 deletions

View File

@@ -33,6 +33,8 @@ export const configObjectExplorerGroupBySchemaFlagName = 'mssql.objectExplorer.g
export const configAsyncParallelProcessingName = 'mssql.parallelMessageProcessing';
export const configEnableSqlAuthenticationProviderName = 'mssql.enableSqlAuthenticationProvider';
export const configEnableConnectionPoolingName = 'mssql.enableConnectionPooling';
export const configHttpProxy = 'http.proxy';
export const configHttpProxyStrictSSL = 'http.proxyStrictSSL';
// COMMANDNAMES //////////////////////////////////////////////////////////
export const cmdObjectExplorerEnableGroupBySchemaCommand = 'mssql.enableGroupBySchema';

View File

@@ -153,6 +153,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
}
await displayReloadAds();
}
// Prompt to reload ADS as we send the proxy URL to STS to instantiate Http Client instances.
if (e.affectsConfiguration(Constants.configHttpProxy) || e.affectsConfiguration(Constants.configHttpProxyStrictSSL)) {
await displayReloadAds();
}
}));
registerTableDesignerCommands(appContext);

View File

@@ -22,6 +22,9 @@ const parallelMessageProcessingConfig = 'parallelMessageProcessing';
const enableSqlAuthenticationProviderConfig = 'enableSqlAuthenticationProvider';
const enableConnectionPoolingConfig = 'enableConnectionPooling';
const tableDesignerPreloadConfig = 'tableDesigner.preloadDatabaseModel';
const httpConfig = 'http';
const configProxy = 'proxy';
const configProxyStrictSSL = 'proxyStrictSSL';
/**
*
@@ -85,6 +88,19 @@ export function getConfigLogRetentionSeconds(): number | undefined {
}
}
export function getHttpProxyUrl(): string | undefined {
let config = getConfiguration(httpConfig);
if (config) {
return config[configProxy];
} return undefined;
}
export function getHttpProxyStrictSSL(): boolean {
let config = getConfiguration(httpConfig);
if (config) {
return config.get<boolean>(configProxyStrictSSL, true); // true by default
} return true; // true by default.
}
/**
* The tracing level defined in the package.json
*/
@@ -202,6 +218,15 @@ export function getCommonLaunchArgsAndCleanupOldLogFiles(logPath: string, fileNa
}
// Always enable autoflush so that log entries are written immediately to disk, otherwise we can end up with partial logs
launchArgs.push('--autoflush-log');
let httpProxy = getHttpProxyUrl();
if (httpProxy) {
launchArgs.push('--http-proxy-url');
launchArgs.push(httpProxy);
if (getHttpProxyStrictSSL()) {
launchArgs.push('--http-proxy-strict-ssl')
}
}
return launchArgs;
}