franckcuny/net-riak — pull request #20 by Mainframe2008 (2013-02-01 16:25:42+00:00)
Title: SSL Support

Robin, Frank,

It took me a while but I managed to get https into Net:Riak. Since I only use the REST interface, I put it there.

The following example show the simplest application:
#!/usr/bin/env perl

use Net::Riak;

my $ssl_opts = {
verify_hostname => 0,
SSL_verify_mode => 0,
SSL_ca_file => '/dev/null'
};

$client = Net::Riak->new( host => 'https://192.168.40.128:8098', ua_timeout => 90, ssl_opts => $ssl_opts );

For ssl the is an extra requirement: LWP::Protocol:https
The changes I made were in the Net::Riak::Role::REST.pm and Net::Riak::Role::UserAgent.pm module.
In the REST module I added an attribute called ssl. Which is set by default to 0. But is set to 1 if in the _build_uri is an https uri detected.

In the UserAgent.pm module I added an attribute called ssl_opts which is a hashref holding the ssl options (IO::Socket::SSL). These attributes are used in the useragent attribute's default settings.

I hope you can integrate this in a new version of Net::Riak.

Kind regards

Theo