Skip to content

Commit

Permalink
network: Fix request ecdhCurve mismatch errors.
Browse files Browse the repository at this point in the history
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 -
nodejs/node#16196

Fixes: zulip#594.
  • Loading branch information
philippebersoult authored and kanishk98 committed Jun 18, 2019
1 parent 8ffd39f commit 5610451
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/main/linuxupdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
9 changes: 6 additions & 3 deletions app/renderer/js/utils/domain-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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) => {
Expand All @@ -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 => {
Expand Down

0 comments on commit 5610451

Please sign in to comment.