tls: Provide buffer to Connection.setSession
authorisaacs <i@izs.me>
Sat, 13 Oct 2012 01:41:30 +0000 (18:41 -0700)
committerisaacs <i@izs.me>
Tue, 23 Oct 2012 17:48:50 +0000 (10:48 -0700)
lib/tls.js

index ed6c5a7..e184c29 100644 (file)
@@ -1296,7 +1296,10 @@ exports.connect = function(/* [port, host], options, cb */) {
                             });
 
   if (options.session) {
-    pair.ssl.setSession(options.session);
+    var session = options.session;
+    if (typeof session === 'string')
+      session = new Buffer(session, 'binary');
+    pair.ssl.setSession(session);
   }
 
   var cleartext = pipe(pair, socket);