Skip to content

Commit 08fd621

Browse files
authored
Remove HttpsProxyAgent (#9833)
1 parent feb70a3 commit 08fd621

File tree

4 files changed

+5
-152
lines changed

4 files changed

+5
-152
lines changed

Extension/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "cpptools",
33
"displayName": "C/C++",
44
"description": "C/C++ IntelliSense, debugging, and code browsing.",
5-
"version": "1.12.3-main",
5+
"version": "1.12.4-main",
66
"publisher": "ms-vscode",
77
"icon": "LanguageCCPP_color_128x.png",
88
"readme": "README.md",
@@ -2920,7 +2920,7 @@
29202920
"rust"
29212921
],
29222922
"_aiKeyComment": "Ignore 'Property aiKey is not allowed'. See https://github.com/microsoft/vscode/issues/76493",
2923-
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
2923+
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
29242924
"variables": {
29252925
"pickProcess": "extension.pickNativeProcess",
29262926
"pickRemoteProcess": "extension.pickRemoteNativeProcess"
@@ -4450,7 +4450,7 @@
44504450
"rust"
44514451
],
44524452
"_aiKeyComment": "Ignore 'Property aiKey is not allowed'. See https://github.com/microsoft/vscode/issues/76493",
4453-
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
4453+
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
44544454
"variables": {
44554455
"pickProcess": "extension.pickNativeProcess"
44564456
},
@@ -5440,7 +5440,6 @@
54405440
"gulp-mocha": "^8.0.0",
54415441
"gulp-sourcemaps": "^2.6.5",
54425442
"gulp-typescript": "^5.0.1",
5443-
"http-proxy-agent": "^2.1.0",
54445443
"minimist": "^1.2.6",
54455444
"mocha": "^8.3.2",
54465445
"parse-git-config": "^3.0.0",
@@ -5462,7 +5461,6 @@
54625461
"editorconfig": "^0.15.3",
54635462
"escape-string-regexp": "^2.0.0",
54645463
"glob": "^7.1.6",
5465-
"https-proxy-agent": "^2.2.4",
54665464
"minimatch": "^3.0.4",
54675465
"mkdirp": "^0.5.5",
54685466
"plist": "^3.0.5",

Extension/src/common.ts

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ import * as os from 'os';
99
import * as child_process from 'child_process';
1010
import * as vscode from 'vscode';
1111
import * as Telemetry from './telemetry';
12-
import HttpsProxyAgent = require('https-proxy-agent');
13-
import * as url from 'url';
1412
import { PlatformInformation } from './platform';
1513
import { getOutputChannelLogger, showOutputChannel } from './logger';
1614
import * as assert from 'assert';
17-
import * as https from 'https';
1815
import * as tmp from 'tmp';
19-
import { ClientRequest, OutgoingHttpHeaders } from 'http';
2016
import * as nls from 'vscode-nls';
2117
import * as jsonc from 'comment-json';
2218
import { TargetPopulation } from 'vscode-tas-client';
@@ -443,32 +439,6 @@ export function getDebugAdaptersPath(file: string): string {
443439
return path.resolve(getExtensionFilePath("debugAdapters"), file);
444440
}
445441

446-
export function getHttpsProxyAgent(): HttpsProxyAgent | undefined {
447-
let proxy: string | undefined = vscode.workspace.getConfiguration().get<string>('http.proxy');
448-
if (!proxy) {
449-
proxy = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
450-
if (!proxy) {
451-
return undefined; // No proxy
452-
}
453-
}
454-
455-
// Basic sanity checking on proxy url
456-
const proxyUrl: any = url.parse(proxy);
457-
if (proxyUrl.protocol !== "https:" && proxyUrl.protocol !== "http:") {
458-
return undefined;
459-
}
460-
461-
const strictProxy: any = vscode.workspace.getConfiguration().get("http.proxyStrictSSL", true);
462-
const proxyOptions: any = {
463-
host: proxyUrl.hostname,
464-
port: parseInt(proxyUrl.port, 10),
465-
auth: proxyUrl.auth,
466-
rejectUnauthorized: strictProxy
467-
};
468-
469-
return new HttpsProxyAgent(proxyOptions);
470-
}
471-
472442
/** Test whether a file exists */
473443
export function checkFileExists(filePath: string): Promise<boolean> {
474444
return new Promise((resolve, reject) => {
@@ -899,79 +869,6 @@ export function createTempFileWithPostfix(postfix: string): Promise<tmp.FileResu
899869
});
900870
}
901871

902-
export function downloadFileToDestination(urlStr: string, destinationPath: string, headers?: OutgoingHttpHeaders): Promise<void> {
903-
return new Promise<void>((resolve, reject) => {
904-
const parsedUrl: url.Url = url.parse(urlStr);
905-
const request: ClientRequest = https.request({
906-
host: parsedUrl.host,
907-
path: parsedUrl.path,
908-
agent: getHttpsProxyAgent(),
909-
rejectUnauthorized: vscode.workspace.getConfiguration().get('http.proxyStrictSSL', true),
910-
headers: headers
911-
}, (response) => {
912-
if (response.statusCode === 301 || response.statusCode === 302) { // If redirected
913-
// Download from new location
914-
let redirectUrl: string;
915-
if (typeof response.headers.location === 'string') {
916-
redirectUrl = response.headers.location;
917-
} else {
918-
if (!response.headers.location) {
919-
return reject(new Error(localize("invalid.download.location.received", 'Invalid download location received')));
920-
}
921-
redirectUrl = response.headers.location[0];
922-
}
923-
return resolve(downloadFileToDestination(redirectUrl, destinationPath, headers));
924-
}
925-
if (response.statusCode !== 200) { // If request is not successful
926-
return reject();
927-
}
928-
// Write file using downloaded data
929-
const createdFile: fs.WriteStream = fs.createWriteStream(destinationPath);
930-
createdFile.on('finish', () => { resolve(); });
931-
response.on('error', (error) => { reject(error); });
932-
response.pipe(createdFile);
933-
});
934-
request.on('error', (error) => { reject(error); });
935-
request.end();
936-
});
937-
}
938-
939-
export function downloadFileToStr(urlStr: string, headers?: OutgoingHttpHeaders): Promise<any> {
940-
return new Promise<string>((resolve, reject) => {
941-
const parsedUrl: url.Url = url.parse(urlStr);
942-
const request: ClientRequest = https.request({
943-
host: parsedUrl.host,
944-
path: parsedUrl.path,
945-
agent: getHttpsProxyAgent(),
946-
rejectUnauthorized: vscode.workspace.getConfiguration().get('http.proxyStrictSSL', true),
947-
headers: headers
948-
}, (response) => {
949-
if (response.statusCode === 301 || response.statusCode === 302) { // If redirected
950-
// Download from new location
951-
let redirectUrl: string;
952-
if (typeof response.headers.location === 'string') {
953-
redirectUrl = response.headers.location;
954-
} else {
955-
if (!response.headers.location) {
956-
return reject(new Error(localize("invalid.download.location.received", 'Invalid download location received')));
957-
}
958-
redirectUrl = response.headers.location[0];
959-
}
960-
return resolve(downloadFileToStr(redirectUrl, headers));
961-
}
962-
if (response.statusCode !== 200) { // If request is not successful
963-
return reject();
964-
}
965-
let downloadedData: string = '';
966-
response.on('data', (data) => { downloadedData += data; });
967-
response.on('error', (error) => { reject(error); });
968-
response.on('end', () => { resolve(downloadedData); });
969-
});
970-
request.on('error', (error) => { reject(error); });
971-
request.end();
972-
});
973-
}
974-
975872
function resolveWindowsEnvironmentVariables(str: string): string {
976873
return str.replace(/%([^%]+)%/g, (withPercents, withoutPercents) => {
977874
const found: string | undefined = process.env[withoutPercents];

Extension/src/telemetry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class ExperimentationTelemetry implements IExperimentationTelemetry {
5555

5656
let initializationPromise: Promise<IExperimentationService> | undefined;
5757
let experimentationTelemetry: ExperimentationTelemetry | undefined;
58-
const appInsightsKey: string = "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217";
58+
const appInsightsKey: string = "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255";
5959

6060
export function activate(): void {
6161
try {

Extension/yarn.lock

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -700,13 +700,6 @@ acorn@^8.5.0:
700700
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30"
701701
integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==
702702

703-
agent-base@4, agent-base@^4.3.0:
704-
version "4.3.0"
705-
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
706-
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
707-
dependencies:
708-
es6-promisify "^5.0.0"
709-
710703
agent-base@6:
711704
version "6.0.2"
712705
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77"
@@ -1536,13 +1529,6 @@ [email protected]:
15361529
memoizee "0.4.X"
15371530
object-assign "4.X"
15381531

1539-
1540-
version "3.1.0"
1541-
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
1542-
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
1543-
dependencies:
1544-
ms "2.0.0"
1545-
15461532
15471533
version "3.2.6"
15481534
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
@@ -1571,7 +1557,7 @@ debug@^2.2.0, debug@^2.3.3, debug@^2.6.9:
15711557
dependencies:
15721558
ms "2.0.0"
15731559

1574-
debug@^3.1.0, debug@^3.2.7:
1560+
debug@^3.2.7:
15751561
version "3.2.7"
15761562
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a"
15771563
integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==
@@ -1887,18 +1873,6 @@ es6-iterator@^2.0.1, es6-iterator@^2.0.3, es6-iterator@~2.0.3:
18871873
es5-ext "^0.10.35"
18881874
es6-symbol "^3.1.1"
18891875

1890-
es6-promise@^4.0.3:
1891-
version "4.2.8"
1892-
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
1893-
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==
1894-
1895-
es6-promisify@^5.0.0:
1896-
version "5.0.0"
1897-
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
1898-
integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=
1899-
dependencies:
1900-
es6-promise "^4.0.3"
1901-
19021876
es6-symbol@^3.1.1, es6-symbol@~3.1.3:
19031877
version "3.1.3"
19041878
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18"
@@ -2996,14 +2970,6 @@ hosted-git-info@^2.1.4, hosted-git-info@^3.0.8:
29962970
dependencies:
29972971
lru-cache "^6.0.0"
29982972

2999-
http-proxy-agent@^2.1.0:
3000-
version "2.1.0"
3001-
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405"
3002-
integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==
3003-
dependencies:
3004-
agent-base "4"
3005-
debug "3.1.0"
3006-
30072973
http-proxy-agent@^4.0.1:
30082974
version "4.0.1"
30092975
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a"
@@ -3013,14 +2979,6 @@ http-proxy-agent@^4.0.1:
30132979
agent-base "6"
30142980
debug "4"
30152981

3016-
https-proxy-agent@^2.2.4:
3017-
version "2.2.4"
3018-
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b"
3019-
integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==
3020-
dependencies:
3021-
agent-base "^4.3.0"
3022-
debug "^3.1.0"
3023-
30242982
https-proxy-agent@^5.0.0:
30252983
version "5.0.0"
30262984
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2"

0 commit comments

Comments
 (0)