From 8d883f131bb96bf552f053196e0ca18e9487e445 Mon Sep 17 00:00:00 2001 From: Courtland Idstrom Date: Tue, 17 Jan 2017 22:58:43 -0800 Subject: [PATCH] feat(electron-updater): Port support for downloads, Protocol support for generic backend Use specified port when downloading file Pass protocol through, allowing http: for local testing. Default is still https: --- packages/electron-auto-updater/src/GenericProvider.ts | 2 +- packages/electron-auto-updater/src/electronHttpExecutor.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/electron-auto-updater/src/GenericProvider.ts b/packages/electron-auto-updater/src/GenericProvider.ts index 7a2378464f2..ea607a2b6fe 100644 --- a/packages/electron-auto-updater/src/GenericProvider.ts +++ b/packages/electron-auto-updater/src/GenericProvider.ts @@ -16,7 +16,7 @@ export class GenericProvider implements Provider { const channelFile = getChannelFilename(this.channel) const pathname = path.posix.resolve(this.baseUrl.pathname || "/", `${channelFile}`) try { - result = await request({hostname: this.baseUrl.hostname, port: this.baseUrl.port || "443", path: `${pathname}${this.baseUrl.search || ""}`}) + result = await request({hostname: this.baseUrl.hostname, port: this.baseUrl.port || "443", path: `${pathname}${this.baseUrl.search || ""}`, protocol: this.baseUrl.protocol}) } catch (e) { if (e instanceof HttpError && e.response.statusCode === 404) { diff --git a/packages/electron-auto-updater/src/electronHttpExecutor.ts b/packages/electron-auto-updater/src/electronHttpExecutor.ts index 62a3ba831d6..cb5e0b03e9c 100644 --- a/packages/electron-auto-updater/src/electronHttpExecutor.ts +++ b/packages/electron-auto-updater/src/electronHttpExecutor.ts @@ -41,6 +41,7 @@ export class ElectronHttpExecutor extends HttpExecutorrequestOptions.headers).authorization = token.startsWith("Basic") ? token : `token ${token}` } - requestOptions.protocol = "https:" + requestOptions.protocol = options.Protocol || "https:" return new BluebirdPromise((resolve, reject, onCancel) => { const request = net.request(options, response => { try {