Skip to content

Commit

Permalink
Update all Senders to use https.globalAgent instead of tlsRestrictedA…
Browse files Browse the repository at this point in the history
…gent (#621)
  • Loading branch information
Mark Wolff committed May 27, 2020
1 parent 4ec8ba2 commit d69b388
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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

0 comments on commit d69b388

Please sign in to comment.