lib/Rex/Interface/Connection/HTTPS.pm

filter: Statementstmt 41.0% 16 / 39 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 50.0% 5 / 10 Podpod 0.0% 0 / 3 totaltotal 30.8% 21 / 68 CC 7 SCAR 24.4
CC
7
Cov
31%
ua
30.0
new
6.0
_get_port
6.0
CRAP 11.4
« lib/Rex/Task.pm ↑ Summary blib/lib/Rex/Output.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4  
5 package Rex::Interface::Connection::HTTPS;
6  
7 1 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Rex::Interface::Connection::HTTP;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use base qw(Rex::Interface::Connection::HTTP);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our $VERSION = '1.16.1'; # VERSION
13  
14 1 ▶use Rex::Logger;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
17 0 my $that = shift;
18 0 ▶ my $proto = ref($that) || $that;
Condition0%0/3
ref $that || $that
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table0%0/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
19 0 my $self = $that->SUPER::new(@_);
20  
21 0 bless( $self, $proto );
22  
23 0 return $self;
24 }
25  
26 0 ▶sub get_connection_type { return "HTTP"; }
Subroutine get_connection_type: not called CC=1 SCAR=6.9
Pod undocumented
27  
28 0 ▶sub _get_proto {
Subroutine _get_proto: not called CC=1 SCAR=6.9
29 0 return "https";
30 }
31  
32 0 ▶sub _get_port {
Subroutine _get_port: not called CC=2 SCAR=17.9
33 0 my ( $self, $port ) = @_;
34 0 ▶ return $port || 8443;
Condition0%0/2
$port || 8443
l!l
00
MC/DC0%0/1
$port || 8443
$port
Truth table0%0/2
A
A= $port
Aresult
11
00
35 }
36  
37 0 ▶sub ua {
Subroutine ua: not called CC=5 SCAR=34.0
Pod undocumented
38 0 my ($self) = @_;
39 0 ▶ return $self->{ua} if $self->{ua};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"ua"} 0 0 0
40  
41 0 my $ssl_opts = {};
42  
43 0 ▶ if ( Rex::Config->get_ca ) {
Branch: 1 branch
BranchTrueFalseTotal
if ('Rex::Config'->get_ca) { } 0 0 0
44 0 Rex::Logger::debug("SSL: Verifying Hostname");
45 0 $ssl_opts->{verify_hostname} = 1;
46 0 $ssl_opts->{SSL_ca_file} = Rex::Config->get_ca;
47 }
48 else {
49 0 Rex::Logger::debug("SSL: NOT Verifying Hostname");
50 0 $ssl_opts->{verify_hostname} = 0;
51 }
52  
53 0 ▶ if ( Rex::Config->get_ca_cert ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("Rex::Config"->get_ca_cert) 0 0 0
54 0 $ssl_opts->{SSL_cert_file} = Rex::Config->get_ca_cert;
55 }
56  
57 0 ▶ if ( Rex::Config->get_ca_key ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("Rex::Config"->get_ca_key) 0 0 0
58 0 $ssl_opts->{SSL_key_file} = Rex::Config->get_ca_key;
59 }
60  
61 0 $self->{ua} = LWP::UserAgent->new( ssl_opts => $ssl_opts, );
62 }
63  
64 1 1;
« lib/Rex/Task.pm ↑ Summary blib/lib/Rex/Output.pm »