Skip to content

Commit

Permalink
tls: remove unused arg to createSecureContext()
Browse files Browse the repository at this point in the history
The context arg is unused by node or its test suites and undocumented.
Remove it.

PR-URL: nodejs#24241
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
sam-github authored and kiyomizumia committed Nov 15, 2018
1 parent eaba964 commit a0806a7
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions lib/_tls_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,13 @@ const { SSL_OP_CIPHER_SERVER_PREFERENCE } = internalBinding('constants').crypto;
let toBuf = null;

const { SecureContext: NativeSecureContext } = internalBinding('crypto');
function SecureContext(secureProtocol, secureOptions, context) {
function SecureContext(secureProtocol, secureOptions) {
if (!(this instanceof SecureContext)) {
return new SecureContext(secureProtocol, secureOptions, context);
return new SecureContext(secureProtocol, secureOptions);
}

if (context) {
this.context = context;
} else {
this.context = new NativeSecureContext();

if (secureProtocol) {
this.context.init(secureProtocol);
} else {
this.context.init();
}
}
this.context = new NativeSecureContext();
this.context.init(secureProtocol);

if (secureOptions) this.context.setOptions(secureOptions);
}
Expand All @@ -68,19 +59,17 @@ function validateKeyCert(name, value) {
exports.SecureContext = SecureContext;


exports.createSecureContext = function createSecureContext(options, context) {
exports.createSecureContext = function createSecureContext(options) {
if (!options) options = {};

var secureOptions = options.secureOptions;
if (options.honorCipherOrder)
secureOptions |= SSL_OP_CIPHER_SERVER_PREFERENCE;

const c = new SecureContext(options.secureProtocol, secureOptions, context);
const c = new SecureContext(options.secureProtocol, secureOptions);
var i;
var val;

if (context) return c;

// NOTE: It's important to add CA before the cert to be able to load
// cert's issuer in C++ code.
const { ca } = options;
Expand Down

0 comments on commit a0806a7

Please sign in to comment.