From f3e60356eca2a548c7a205ef2ad5d2bdbfd53332 Mon Sep 17 00:00:00 2001 From: "Kevin L. Kane" Date: Tue, 4 Aug 2015 08:45:22 -0400 Subject: [PATCH] allowing CA file to be specified seperate from SSL key and cert to allow for host name verification only, thanks to "IMBS David" --- lib/REST/Client.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/REST/Client.pm b/lib/REST/Client.pm index 34c1437..963e652 100644 --- a/lib/REST/Client.pm +++ b/lib/REST/Client.pm @@ -366,10 +366,12 @@ sub request { $ua->ssl_opts(SSL_cert_file => $self->getCert); $ua->ssl_opts(SSL_key_file => $self->getKey); - if(my $ca = $self->getCa){ - croak "REST::Client exception: Cannot read CA file" unless -f $ca; - $ua->ssl_opts(SSL_ca_file => $ca); - } + } + + #prime LWP with CA file if we have one + if(my $ca = $self->getCa){ + croak "REST::Client exception: Cannot read CA file" unless -f $ca; + $ua->ssl_opts(SSL_ca_file => $ca); } #prime LWP with PKCS12 certificate if we have one