tls: null not valid as a renegotiate callback
Allow undefined as a callback, but do not allow null. PR-URL: https://github.com/nodejs/node/pull/25929 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
6da82b1057
commit
00d49ad673
@ -601,7 +601,7 @@ TLSSocket.prototype._init = function(socket, wrap) {
|
||||
TLSSocket.prototype.renegotiate = function(options, callback) {
|
||||
if (options === null || typeof options !== 'object')
|
||||
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
|
||||
if (callback != null && typeof callback !== 'function')
|
||||
if (callback !== undefined && typeof callback !== 'function')
|
||||
throw new ERR_INVALID_CALLBACK();
|
||||
|
||||
if (this.destroyed)
|
||||
|
@ -63,6 +63,12 @@ server.listen(0, common.mustCall(() => {
|
||||
type: TypeError,
|
||||
});
|
||||
|
||||
common.expectsError(() => client.renegotiate({}, null), {
|
||||
code: 'ERR_INVALID_CALLBACK',
|
||||
type: TypeError,
|
||||
});
|
||||
|
||||
|
||||
// Negotiation is still permitted for this first
|
||||
// attempt. This should succeed.
|
||||
let ok = client.renegotiate(options, common.mustCall((err) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user