Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update all Senders to use https.globalAgent instead of tlsRestrictedAgent #621

Merged
merged 4 commits into from May 27, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions Library/QuickPulseSender.ts
Expand Up @@ -2,6 +2,7 @@ import https = require("https");
import Config = require("./Config");
import AutoCollectHttpDependencies = require("../AutoCollection/HttpDependencies");
import Logging = require("./Logging");
import Util = require("./Util");

// Types
import * as http from "http";
Expand Down Expand Up @@ -50,6 +51,13 @@ class QuickPulseSender {
}
};

// HTTPS only
if (this._config.httpsAgent) {
(<any>options).agent = this._config.httpsAgent;
} else {
(<any>options).agent = Util.tlsRestrictedAgent;
}

const req = https.request(options, (res: http.IncomingMessage) => {
const shouldPOSTData = res.headers[QuickPulseConfig.subscribed] === "true";
this._consecutiveErrors = 0;
Expand Down
4 changes: 2 additions & 2 deletions Library/Sender.ts
Expand Up @@ -223,7 +223,7 @@ class Sender {
if (Sender.ACL_IDENTITY) {
return callback(null, Sender.ACL_IDENTITY);
}
var psProc = child_process.spawn(Sender.POWERSHELL_PATH,
var psProc = child_process.spawn(Sender.POWERSHELL_PATH,
["-Command", "[System.Security.Principal.WindowsIdentity]::GetCurrent().Name"], <any>{
windowsHide: true,
stdio: ['ignore', 'pipe', 'pipe'] // Needed to prevent hanging on Win 7
Expand All @@ -245,7 +245,7 @@ class Sender {
}
// Some very old versions of Node (< 0.11) don't have this
if (child_process.spawnSync) {
var psProc = child_process.spawnSync(Sender.POWERSHELL_PATH,
var psProc = child_process.spawnSync(Sender.POWERSHELL_PATH,
["-Command", "[System.Security.Principal.WindowsIdentity]::GetCurrent().Name"], <any>{
windowsHide: true,
stdio: ['ignore', 'pipe', 'pipe'] // Needed to prevent hanging on Win 7
Expand Down