THRIFT-2369 Add ssl support for nodejs implementation
Patch: Pierre Lamot
diff --git a/lib/nodejs/test/multiplex_client.js b/lib/nodejs/test/multiplex_client.js
index 6cf6975..9ef716b 100644
--- a/lib/nodejs/test/multiplex_client.js
+++ b/lib/nodejs/test/multiplex_client.js
@@ -30,6 +30,7 @@
program
.option('-p, --protocol <protocol>', 'Set thift protocol (binary|json) [protocol]')
.option('-t, --transport <transport>', 'Set thift transport (buffered|framed) [transport]')
+ .option('--ssl', 'use ssl transport')
.parse(process.argv);
var protocol = undefined;
@@ -53,10 +54,18 @@
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 mp = new thrift.Multiplexer();