THRIFT-3272 (THRIFT-4066) fix perl SSL authentication support; fixed error in erlang test client using wrong key file and added CA
Client: Perl
This closes #1189
diff --git a/test/perl/TestClient.pl b/test/perl/TestClient.pl
index 7ec32bf..483c964 100755
--- a/test/perl/TestClient.pl
+++ b/test/perl/TestClient.pl
@@ -47,15 +47,19 @@
Usage: $0 [OPTIONS]
Options: (default)
+ --ca CA to validate server with.
--cert Certificate to use.
Required if using --ssl.
+ --ciphers Acceptable cipher list.
--domain-socket <file> Use a unix domain socket.
--help Show usage.
+ --key Certificate key.
+ Required if using --ssl.
--port <portnum> 9090 Port to use.
--protocol {binary} binary Protocol to use.
--ssl If present, use SSL.
--transport {buffered|framed} buffered Transport to use.
-
+
EOF
}
@@ -66,7 +70,10 @@
);
GetOptions(\%opts, qw (
+ ca=s
cert=s
+ ciphers=s
+ key=s
domain-socket=s
help
host=s
@@ -81,18 +88,13 @@
exit 0;
}
-if ($opts{ssl} and not defined $opts{cert}) {
- usage();
- exit 1;
-}
-
my $socket = undef;
if ($opts{"domain-socket"}) {
$socket = new Thrift::UnixSocket($opts{"domain-socket"});
} elsif ($opts{ssl}) {
- $socket = new Thrift::SSLSocket($opts{host}, $opts{port});
+ $socket = new Thrift::SSLSocket(\%opts);
} else {
- $socket = new Thrift::Socket($opts{host}, $opts{port});
+ $socket = new Thrift::Socket($opts{host}, $opts{port});
}
my $transport;
@@ -117,7 +119,7 @@
eval {
$transport->open();
-};
+};
if($@){
die(Dumper($@));
}