Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,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)
Expand Down
6 changes: 6 additions & 0 deletions test/parallel/test-tls-disable-renegotiation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down