THRIFT-2369 Add ssl support for nodejs implementation
Patch: Pierre Lamot
diff --git a/lib/nodejs/test/client.js b/lib/nodejs/test/client.js
index 90d7467..43d88f0 100644
--- a/lib/nodejs/test/client.js
+++ b/lib/nodejs/test/client.js
@@ -21,6 +21,7 @@
 //"ThriftTest" suite. This client will test any protocol/transport
 //combination specified on the command line.
 
+var fs = require('fs');
 var assert = require('assert');
 var thrift = require('thrift');
 var ThriftTransports = require('thrift/transport');
@@ -33,6 +34,7 @@
 program
   .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|json) [protocol]')
   .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed) [transport]')
+  .option('--ssl', 'use SSL transport')
   .parse(process.argv);
 
 var protocol = undefined;
@@ -56,10 +58,19 @@
   transport = ThriftTransports.TBufferedTransport;
 }
 
-var connection = thrift.createConnection('localhost', 9090, {
+var options = {
   transport: transport,
   protocol: protocol
-});
+};
+
+var connection = undefined;
+
+if (program.ssl) {
+  options.rejectUnauthorized = false;
+  connection = thrift.createSSLConnection('localhost', 9090, options);
+} else {
+  connection = thrift.createConnection('localhost', 9090, options);
+}
 
 var client = thrift.createClient(ThriftTest, connection);