Skip to content

Commit c3839f7

Browse files
committed
tls: fix/annotate connect arg comments
PR-URL: #9800 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent d4f00fe commit c3839f7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/_tls_wrap.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,11 @@ function normalizeConnectArgs(listArgs) {
975975
var options = args[0];
976976
var cb = args[1];
977977

978+
// If args[0] was options, then normalize dealt with it.
979+
// If args[0] is port, or args[0], args[1] is host,port, we need to
980+
// find the options and merge them in, normalize's options has only
981+
// the host/port/path args that it knows about, not the tls options.
982+
// This means that options.host overrides a host arg.
978983
if (listArgs[1] !== null && typeof listArgs[1] === 'object') {
979984
options = util._extend(options, listArgs[1]);
980985
} else if (listArgs[2] !== null && typeof listArgs[2] === 'object') {
@@ -984,7 +989,7 @@ function normalizeConnectArgs(listArgs) {
984989
return (cb) ? [options, cb] : [options];
985990
}
986991

987-
exports.connect = function(/* [port, host], options, cb */) {
992+
exports.connect = function(/* [port,] [host,] [options,] [cb] */) {
988993
const argsLen = arguments.length;
989994
var args = new Array(argsLen);
990995
for (var i = 0; i < argsLen; i++)

0 commit comments

Comments
 (0)