#52 Add a way to set ssl_opts

open
nobody
5
2012-08-31
2012-08-31
Thomax G.
No

Hi again,

we tried hard to set the SSL_cert_file and SSL_key_file ssl_opts. The Crypt::SSLeay
doc says, it could be done with $ENV{HTTP_CERT_FILE} and $ENV{HTTP_KEY_FILE}
but that's all lies :-). Somehow, deep in the jungle, somewhere stopped implementing
the way from the environment vars down to the real options. We suspect LWP::UserAgent.

But because it could also be done by calling the ssl_opts function and set the right
parameters, we introduced an empty function set_ssl_opts() in Transport/HTTP.pm
and get called from send_receive(). This empty function can be overwritten like you
do with get_basic_credentials. The thing is, we couldn't call ssl_opts in the same way,
that's why we introduced the empty function.

Now we are able to set the ssl_opts like this:

# overwrite the set_ssl_opts function, set the ssl_opts parameter
# which get used in the low level SSL transport layers
*SOAP::WSDL::Transport::HTTP::set_ssl_opts
= sub {
my $self = shift;
$self->ssl_opts( SSL_ca_file => "/etc/pki/CA/caservercert.pem" );
$self->ssl_opts( SSL_cert_file => "/etc/pki/CA/certs/customer.crt" );
$self->ssl_opts( SSL_key_file => "/etc/pki/CA/private/customer.key" );
};

If you like this feature you can put it in your code base, if not, please let us know why a
d perhaps the better solution.

The patch is generated with diff -urpN and is based on SOAP-WSDL-2.00.10.

Thank you for your good work & keep it going,

thomax & matthias

Discussion

  • Thomax G.
    Thomax G.
    2012-08-31

     
    Attachments