Skip to content

lib: refactor tls options handle in https.js #27118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 27 additions & 65 deletions lib/https.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,76 +156,38 @@ Object.setPrototypeOf(Agent, HttpAgent);
Agent.prototype.createConnection = createConnection;

Agent.prototype.getName = function getName(options) {
var name = HttpAgent.prototype.getName.call(this, options);

name += ':';
if (options.ca)
name += options.ca;

name += ':';
if (options.cert)
name += options.cert;

name += ':';
if (options.clientCertEngine)
name += options.clientCertEngine;

name += ':';
if (options.ciphers)
name += options.ciphers;

name += ':';
if (options.key)
name += options.key;

name += ':';
if (options.pfx)
name += options.pfx;

name += ':';
if (options.rejectUnauthorized !== undefined)
name += options.rejectUnauthorized;
let name = HttpAgent.prototype.getName.call(this, options);

const options_keys = [
'ca',
'cert',
'ciphers',
'clientCertEngine',
'crl',
'dhparam',
'ecdhCurve',
'honorCipherOrder',
'key',
'maxVersion',
'minVersion',
'pfx',
'rejectUnauthorized',
'secureOptions',
'secureProtocol',
'sessionIdContext'
];

options_keys.forEach((i) => {
name += ':';
if (options[i]) {
name += options[i];
}
});

name += ':';
if (options.servername && options.servername !== options.host)
name += options.servername;

name += ':';
if (options.minVersion)
name += options.minVersion;

name += ':';
if (options.maxVersion)
name += options.maxVersion;

name += ':';
if (options.secureProtocol)
name += options.secureProtocol;

name += ':';
if (options.crl)
name += options.crl;

name += ':';
if (options.honorCipherOrder !== undefined)
name += options.honorCipherOrder;

name += ':';
if (options.ecdhCurve)
name += options.ecdhCurve;

name += ':';
if (options.dhparam)
name += options.dhparam;

name += ':';
if (options.secureOptions !== undefined)
name += options.secureOptions;

name += ':';
if (options.sessionIdContext)
name += options.sessionIdContext;

return name;
};

Expand Down