tls: null not valid as a renegotiate callback · nodejs/node@00d49ad (original) (raw)
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -601,7 +601,7 @@ TLSSocket.prototype._init = function(socket, wrap) { | ||
601 | 601 | TLSSocket.prototype.renegotiate = function(options, callback) { |
602 | 602 | if (options === null | |
603 | 603 | throw new ERR_INVALID_ARG_TYPE('options', 'Object', options); |
604 | -if (callback != null && typeof callback !== 'function') | |
604 | +if (callback !== undefined && typeof callback !== 'function') | |
605 | 605 | throw new ERR_INVALID_CALLBACK(); |
606 | 606 | |
607 | 607 | if (this.destroyed) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -63,6 +63,12 @@ server.listen(0, common.mustCall(() => { | ||
63 | 63 | type: TypeError, |
64 | 64 | }); |
65 | 65 | |
66 | +common.expectsError(() => client.renegotiate({}, null), { | |
67 | +code: 'ERR_INVALID_CALLBACK', | |
68 | +type: TypeError, | |
69 | +}); | |
70 | + | |
71 | + | |
66 | 72 | // Negotiation is still permitted for this first |
67 | 73 | // attempt. This should succeed. |
68 | 74 | let ok = client.renegotiate(options, common.mustCall((err) => { |