From f1700aad1c7211080e227690b40245ee45a590d7 Mon Sep 17 00:00:00 2001 From: Michel Tomas Date: Mon, 19 Nov 2018 11:39:19 +0100 Subject: [PATCH] network: Fix `request` ecdhCurve mismatch errors. The HTTP Node now uses auto for ecdhCurve for SSL connections. This fixes the SSL handshake error while connecting to some Zulip instances. Setting the ecdhCurve to auto is the recommended method for Node > 8.5, more info here - https://github.com/nodejs/node/issues/16196 --- app/main/linuxupdater.js | 3 ++- app/renderer/js/utils/domain-util.js | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/main/linuxupdater.js b/app/main/linuxupdater.js index efbfe9b92..04461fbe5 100644 --- a/app/main/linuxupdater.js +++ b/app/main/linuxupdater.js @@ -21,7 +21,8 @@ function linuxUpdateNotification() { const options = { url, headers: {'User-Agent': 'request'}, - proxy: proxyEnabled ? ProxyUtil.getProxy(url) : '' + proxy: proxyEnabled ? ProxyUtil.getProxy(url) : '', + ecdhCurve: 'auto' }; request(options, (error, response, body) => { diff --git a/app/renderer/js/utils/domain-util.js b/app/renderer/js/utils/domain-util.js index 48184a561..72f9c60c6 100644 --- a/app/renderer/js/utils/domain-util.js +++ b/app/renderer/js/utils/domain-util.js @@ -129,7 +129,8 @@ class DomainUtil { const checkDomain = { url: domain + '/static/audio/zulip.ogg', ca: (certificateLocation) ? certificateLocation : '', - proxy: proxyEnabled ? ProxyUtil.getProxy(domain) : '' + proxy: proxyEnabled ? ProxyUtil.getProxy(domain) : '', + ecdhCurve: 'auto' }; const serverConf = { @@ -206,7 +207,8 @@ class DomainUtil { const proxyEnabled = ConfigUtil.getConfigItem('useManualProxy') || ConfigUtil.getConfigItem('useSystemProxy'); const serverSettingsOptions = { url: domain + '/api/v1/server_settings', - proxy: proxyEnabled ? ProxyUtil.getProxy(domain) : '' + proxy: proxyEnabled ? ProxyUtil.getProxy(domain) : '', + ecdhCurve: 'auto' }; return new Promise((resolve, reject) => { request(serverSettingsOptions, (error, response) => { @@ -232,7 +234,8 @@ class DomainUtil { const proxyEnabled = ConfigUtil.getConfigItem('useManualProxy') || ConfigUtil.getConfigItem('useSystemProxy'); const serverIconOptions = { url, - proxy: proxyEnabled ? ProxyUtil.getProxy(url) : '' + proxy: proxyEnabled ? ProxyUtil.getProxy(url) : '', + ecdhCurve: 'auto' }; // The save will always succeed. If url is invalid, downgrade to default icon. return new Promise(resolve => {