summaryrefslogtreecommitdiff
path: root/lib/_tls_wrap.js
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2016-11-18 11:37:32 -0800
committerSam Roberts <vieuxtech@gmail.com>2016-12-12 08:13:55 -0800
commitc3839f7ed47a4f09fe67fb5a1905a209249c0b9c (patch)
tree5ce5c40eb3ed335ef81f2581e44925532befe49d /lib/_tls_wrap.js
parentd4f00fe1098b0d7b8444565e741d8b457fd9c091 (diff)
downloadandroid-node-v8-c3839f7ed47a4f09fe67fb5a1905a209249c0b9c.tar.gz
android-node-v8-c3839f7ed47a4f09fe67fb5a1905a209249c0b9c.tar.bz2
android-node-v8-c3839f7ed47a4f09fe67fb5a1905a209249c0b9c.zip
tls: fix/annotate connect arg comments
PR-URL: https://github.com/nodejs/node/pull/9800 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r--lib/_tls_wrap.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
index d9dafceb95..b57a40a3be 100644
--- a/lib/_tls_wrap.js
+++ b/lib/_tls_wrap.js
@@ -975,6 +975,11 @@ function normalizeConnectArgs(listArgs) {
var options = args[0];
var cb = args[1];
+ // If args[0] was options, then normalize dealt with it.
+ // If args[0] is port, or args[0], args[1] is host,port, we need to
+ // find the options and merge them in, normalize's options has only
+ // the host/port/path args that it knows about, not the tls options.
+ // This means that options.host overrides a host arg.
if (listArgs[1] !== null && typeof listArgs[1] === 'object') {
options = util._extend(options, listArgs[1]);
} else if (listArgs[2] !== null && typeof listArgs[2] === 'object') {
@@ -984,7 +989,7 @@ function normalizeConnectArgs(listArgs) {
return (cb) ? [options, cb] : [options];
}
-exports.connect = function(/* [port, host], options, cb */) {
+exports.connect = function(/* [port,] [host,] [options,] [cb] */) {
const argsLen = arguments.length;
var args = new Array(argsLen);
for (var i = 0; i < argsLen; i++)