Skip to content

Commit 01c585f

Browse files
authored
Added the ability to fetch timestamp for codesigning through https (#6510)
1 parent 777eb53 commit 01c585f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

authenticode.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,11 @@ function createAuthenticodeHandler(path) {
15661566
options.protocol = timeServerUrl.protocol;
15671567
options.hostname = timeServerUrl.hostname;
15681568
options.path = timeServerUrl.pathname;
1569-
options.port = ((timeServerUrl.port == '') ? 80 : parseInt(timeServerUrl.port));
1569+
let http = require("http")
1570+
if (options.protocol === "https:"){
1571+
http = require("https")
1572+
}
1573+
options.port = ((timeServerUrl.port == '') ? (options.protocol === "https:" ? 443 : 80) : parseInt(timeServerUrl.port));
15701574

15711575
if (options.proxy == null) {
15721576
// No proxy needed
@@ -1584,7 +1588,7 @@ function createAuthenticodeHandler(path) {
15841588

15851589
// Set up the request
15861590
var responseAccumulator = '';
1587-
var req = require('http').request(options, function (res) {
1591+
var req = http.request(options, function (res) {
15881592
res.setEncoding('utf8');
15891593
res.on('data', function (chunk) { responseAccumulator += chunk; });
15901594
res.on('end', function () { func(null, responseAccumulator); });
@@ -1605,12 +1609,12 @@ function createAuthenticodeHandler(path) {
16051609
proxyOptions.protocol = proxyUrl.protocol;
16061610
proxyOptions.hostname = proxyUrl.hostname;
16071611
proxyOptions.path = options.hostname + ':' + options.port;
1608-
proxyOptions.port = ((proxyUrl.port == '') ? 80 : parseInt(proxyUrl.port));
1612+
proxyOptions.port = ((proxyUrl.port == '') ? (options.protocol === "https:" ? 443 : 80) : parseInt(proxyUrl.port));
16091613
}
16101614

16111615
// Set up the proxy request
16121616
var responseAccumulator = '';
1613-
var req = require('http').request(proxyOptions);
1617+
var req = http.request(proxyOptions);
16141618
req.on('error', function (err) { func('' + err); });
16151619
req.on('connect', function (res, socket, head) {
16161620
// Make a request over the HTTP tunnel

0 commit comments

Comments
 (0)