File Coverage

blib/lib/Armadito/Agent/HTTP/Protocol/https.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Armadito::Agent::HTTP::Protocol::https;
2              
3 1     1   12242505 use strict;
  1         8  
  1         50  
4 1     1   10 use warnings;
  1         4  
  1         70  
5 1     1   3 use base qw(LWP::Protocol::https);
  1         30  
  1         739  
6              
7             use IO::Socket::SSL qw(SSL_VERIFY_NONE SSL_VERIFY_PEER);
8              
9             sub import {
10             my ( $class, %params ) = @_;
11              
12             IO::Socket::SSL::set_ctx_defaults( ca_file => $params{ca_cert_file} )
13             if $params{ca_cert_file};
14             IO::Socket::SSL::set_ctx_defaults( ca_path => $params{ca_cert_dir} )
15             if $params{ca_cert_dir};
16             }
17              
18             sub _extra_sock_opts {
19             my ( $self, $host ) = @_;
20              
21             return (
22             SSL_verify_mode => $self->{ua}->{ssl_check} ? SSL_VERIFY_PEER : SSL_VERIFY_NONE,
23             SSL_verifycn_scheme => 'http',
24             SSL_verifycn_name => $host
25             );
26             }
27             1;
28             __END__
29              
30             =head1 NAME
31              
32             Armadito::Agent::HTTP::Protocol::https - HTTPS protocol handler for LWP
33              
34             =head1 DESCRIPTION
35              
36             This is an overrided HTTPS protocol handler for LWP, allowing to use
37             subjectAltNames for checking server certificate.