mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Fix option parsing in tls.connect()
This commit is contained in:
1 parent
cb06abe1e5
commit
df5d5d6342
1 file changed
+12
-21
+12
-21
@@ -650,31 +650,22 @@ Server.prototype.setOptions = function(options) {
|
||||
exports.connect = function(port /* host, options, cb */) {
|
||||
// parse args
|
||||
var host, options = {}, cb;
|
||||
switch (typeof arguments[1]) {
|
||||
case 'string':
|
||||
host = arguments[1];
|
||||
if (typeof arguments[2] == 'object') {
|
||||
options = arguments[2];
|
||||
if (typeof arguments[3] == 'function') cb = arguments[3];
|
||||
} else if (typeof arguments[2] == 'function') {
|
||||
cb = arguments[2];
|
||||
}
|
||||
break;
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
switch (typeof arguments[i]) {
|
||||
case 'string':
|
||||
host = arguments[i];
|
||||
break;
|
||||
|
||||
case 'object':
|
||||
options = arguments[1];
|
||||
if (typeof arguments[2] == 'function') cb = arguments[2];
|
||||
break;
|
||||
case 'object':
|
||||
options = arguments[i];
|
||||
break;
|
||||
|
||||
case 'function':
|
||||
cb = arguments[1];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
case 'function':
|
||||
cb = arguments[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var socket = new net.Stream();
|
||||
|
||||
var sslcontext = crypto.createCredentials(options);
|
||||
|
||||
Reference in new issue
Block a user