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

Fixes: #594.
This commit is contained in:
Michel Tomas
2018-11-19 11:39:19 +01:00
committed by Akash Nimare
parent 925fec71d5
commit 6899a6bc20
2 changed files with 8 additions and 4 deletions

View File

@@ -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) => {

View File

@@ -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 => {