tls: remove unused arg to createSecureContext()
The context arg is unused by node or its test suites and undocumented. Remove it. PR-URL: https://github.com/nodejs/node/pull/24241 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
624a242b05
commit
3b4159c8ed
@ -35,22 +35,13 @@ const { SSL_OP_CIPHER_SERVER_PREFERENCE } = internalBinding('constants').crypto;
|
|||||||
let toBuf = null;
|
let toBuf = null;
|
||||||
|
|
||||||
const { SecureContext: NativeSecureContext } = internalBinding('crypto');
|
const { SecureContext: NativeSecureContext } = internalBinding('crypto');
|
||||||
function SecureContext(secureProtocol, secureOptions, context) {
|
function SecureContext(secureProtocol, secureOptions) {
|
||||||
if (!(this instanceof SecureContext)) {
|
if (!(this instanceof SecureContext)) {
|
||||||
return new SecureContext(secureProtocol, secureOptions, context);
|
return new SecureContext(secureProtocol, secureOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context) {
|
this.context = new NativeSecureContext();
|
||||||
this.context = context;
|
this.context.init(secureProtocol);
|
||||||
} else {
|
|
||||||
this.context = new NativeSecureContext();
|
|
||||||
|
|
||||||
if (secureProtocol) {
|
|
||||||
this.context.init(secureProtocol);
|
|
||||||
} else {
|
|
||||||
this.context.init();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (secureOptions) this.context.setOptions(secureOptions);
|
if (secureOptions) this.context.setOptions(secureOptions);
|
||||||
}
|
}
|
||||||
@ -68,19 +59,17 @@ function validateKeyCert(name, value) {
|
|||||||
exports.SecureContext = SecureContext;
|
exports.SecureContext = SecureContext;
|
||||||
|
|
||||||
|
|
||||||
exports.createSecureContext = function createSecureContext(options, context) {
|
exports.createSecureContext = function createSecureContext(options) {
|
||||||
if (!options) options = {};
|
if (!options) options = {};
|
||||||
|
|
||||||
var secureOptions = options.secureOptions;
|
var secureOptions = options.secureOptions;
|
||||||
if (options.honorCipherOrder)
|
if (options.honorCipherOrder)
|
||||||
secureOptions |= SSL_OP_CIPHER_SERVER_PREFERENCE;
|
secureOptions |= SSL_OP_CIPHER_SERVER_PREFERENCE;
|
||||||
|
|
||||||
const c = new SecureContext(options.secureProtocol, secureOptions, context);
|
const c = new SecureContext(options.secureProtocol, secureOptions);
|
||||||
var i;
|
var i;
|
||||||
var val;
|
var val;
|
||||||
|
|
||||||
if (context) return c;
|
|
||||||
|
|
||||||
// NOTE: It's important to add CA before the cert to be able to load
|
// NOTE: It's important to add CA before the cert to be able to load
|
||||||
// cert's issuer in C++ code.
|
// cert's issuer in C++ code.
|
||||||
const { ca } = options;
|
const { ca } = options;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user