Branch Coverage

blib/lib/IO/Socket/SSL.pm
Criterion Covered Total %
branch 782 1404 55.7


line true false branch
93 0 0 defined &Net::SSLeay::CTX_set_tmp_ecdh && ($openssl_version != 268439631 || length pack('P', 0) == 4) ? :
0 0 defined &Net::SSLeay::CTX_set_ecdh_auto ? :
87 0 $openssl_version >= 269484047 ? :
102 0 0 defined &Net::SSLeay::CTX_set1_curves_list ? :
87 0 defined &Net::SSLeay::CTX_set1_groups_list ? :
120 87 0 if (defined &Net::SSLeay::SESSION_up_ref)
124 87 0 if ($session_upref and defined &Net::SSLeay::CTX_sess_set_new_cb and defined &Net::SSLeay::CTX_sess_set_remove_cb)
133 87 0 if (my $c = defined &Net::SSLeay::CTX_get0_param && eval { do { Net::SSLeay::X509_V_FLAG_PARTIAL_CHAIN() } })
142 87 0 unless (defined &Net::SSLeay::clear_mode)
150 87 0 if ($openssl_version >= 269488128)
158 323 40 if ($on) { }
165 87 0 if ($openssl_version >= 268435456)
232 86 87 unless &Net::SSLeay::library_init()
242 0 0 $can_ecdh eq 'tmp_ecdh' ? :
0 0 $can_ecdh eq 'can_auto' ? :
87 0 $can_ecdh eq 'auto' ? :
257 0 87 unless $dh
372 87 0 if ($ip6)
375 86 1 if (eval { do { require IO::Socket::IP; 'IO::Socket::IP'->VERSION(0.31) } }) { }
0 1 elsif (eval { do { require IO::Socket::INET6; 'IO::Socket::INET6'->VERSION(2.62) } }) { }
397 1 86 unless ($ip6)
401 0 1 unless (defined $ip6)
416 0 0 unless $DEBUG
418 0 0 if ($sub =~ /^IO::Socket::SSL::(?:error|(_internal_error))$/) { }
419 0 0 if $1
424 0 0 if length $file > 20
425 0 0 if @_
488 3 180 if (@_)
490 0 3 if (@_ > 1) { }
3 0 elsif (my $path = shift()) { }
500 131 52 if defined $ca_detected
505 52 0 &Net::SSLeay::SSLeay_version(4) =~ /^OPENSSLDIR: "(.+)"$/ ? :
0 52 &Net::SSLeay::SSLeay_version(5) =~ /^OPENSSLDIR: "(.+)"$/ ? :
513 52 0 if (opendir my $dh, $dir)
515 0 52 unless open my $fh, "<", "$dir/$f"
517 0 52 unless $line =~ /^-+BEGIN (X509 |TRUSTED |)CERTIFICATE-/
525 52 0 if (open my $fh, "<", $file)
527 0 52 unless $line =~ /^-+BEGIN (X509 |TRUSTED |)CERTIFICATE-/
533 0 0 if not %default_ca and do { local $SIG{'__DIE__'}; eval { do { require Mozilla::CA; 1 } } }
552 0 1 if (/^inet4$/i) { }
0 1 elsif (/^inet6$/i) { }
1 0 elsif (/^:?debug(\d+)/) { }
558 0 0 unless (UNIVERSAL::isa($class, "IO::Socket::INET6") or UNIVERSAL::isa($class, "IO::Socket::IP"))
634 0 141 unless $self
646 2 139 if defined $blocking
648 1 140 unless $self->configure_SSL($arg_hash)
650 72 68 if ($arg_hash->{$family_key} ||= $arg_hash->{'Domain'} || $arg_hash->{'Family'})
656 72 0 if $IOCLASS eq "IO::Socket::IP" and not defined $arg_hash->{'GetAddrInfoFlags'}
658 13 127 unless $self->SUPER::configure($arg_hash)
661 2 125 if defined $blocking and not $blocking
670 214 86 unless (defined $is_server)
675 0 300 if $FILTER_SSL_ARGS
683 1 299 unless do { *$self }->{'_SSL_ctx'} = "IO::Socket::SSL::SSL_Context"->new($arg_hash)
693 70 80 if ($err == $Net_SSLeay_ERROR_WANT_READ) { }
2 78 elsif ($err == $Net_SSLeay_ERROR_WANT_WRITE) { }
701 72 0 if ref $self
710 0 97 if do { *$self }->{'_SSL_opened'}
712 97 0 unless (do { *$self }->{'_SSL_opening'})
717 0 97 if $DEBUG >= 2
718 0 97 unless $self->SUPER::connect(@_)
719 0 97 if $DEBUG >= 2
728 15 82 if defined $sh and not $sh
736 2 195 @_ > 1 ? :
737 0 197 if do { *$self }->{'_SSL_opened'}
740 195 2 unless (do { *$self }->{'_SSL_opening'})
742 0 195 if $DEBUG >= 2
747 0 195 if $args->{'SSL_usebio'} and not $biosock
752 0 195 if $use_threads
756 12 183 if ($ctx->{'session_cache'})
761 6 0 $port ? :
765 2 193 if ($biosock) { }
770 0 193 unless defined $fileno
772 0 193 unless &Net::SSLeay::set_fd($ssl, $fileno)
776 0 195 if $DEBUG >= 2 or do { *$self }->{'_SSL_msg_callback'}
778 195 0 if ($can_client_sni) { }
0 0 elsif ($arg_hash->{'SSL_hostname'}) { }
780 17 178 if (exists $arg_hash->{'SSL_hostname'}) { }
85 93 elsif ($host = $arg_hash->{'PeerAddr'} || $arg_hash->{'PeerHost'}) { }
788 85 0 if not $host =~ /[a-z_]/i or $host =~ /:/
792 17 178 if ($host) { }
793 0 17 if $DEBUG >= 2
796 0 178 if $DEBUG >= 2
802 0 0 if $DEBUG >= 2
805 95 98 unless $arg_hash->{'PeerAddr'} or $arg_hash->{'PeerHost'}
806 114 81 if ($ctx->{'verify_name_ref'})
810 64 50 unless (defined $host)
811 64 0 if ($host = $arg_hash->{'PeerAddr'} || $arg_hash->{'PeerHost'})
825 0 195 if ($ocsp & 1) { }
0 195 elsif (not $can_ocsp_staple) { }
114 81 elsif ($ocsp & 18) { }
828 0 0 if $ocsp & 2
834 0 114 if $DEBUG >= 2
837 7 188 if ($ctx->{'session_cache'} and my $session = $ctx->{'session_cache'}->get_session($arg_hash->{'SSL_session_key'}))
850 2 195 exists $args->{'Timeout'} ? :
851 11 186 if (defined $timeout and $timeout > 0 and $self->blocking(0)) { }
852 0 11 if $DEBUG >= 2
858 186 0 if $auto_retry
866 0 223 if $DEBUG >= 3
869 0 223 if $DEBUG >= 3
870 63 160 if ($rv < 0) { }
0 160 elsif ($rv == 0) { }
872 12 51 if (not $err and $dobio)
873 12 0 if &$dobio($self, $SSL_ERROR == "SSL wants a read first", $SSL_ERROR == "SSL wants a write first", \$err)
878 34 17 if ($err)
882 0 34 if $DEBUG >= 1
886 0 17 if $DEBUG >= 2
889 2 15 unless defined $timeout
893 15 0 if ($timeout > 0) { }
896 0 15 if $DEBUG >= 2
897 0 0 $SSL_ERROR == 98381957084376 ? :
15 0 $SSL_ERROR == 98381957083872 ? :
902 0 0 if $DEBUG >= 2
905 1 14 unless ($rv)
906 0 1 if $DEBUG >= 2
916 0 14 if $DEBUG >= 2
924 0 0 if $DEBUG >= 2
931 0 160 if $DEBUG >= 2
935 8 152 if (defined $timeout)
942 0 160 if (my $ocsp_result = do { *$self }->{'_SSL_ocsp_verify'}) { }
0 160 elsif ($ctx->{'ocsp_mode'} & 2) { }
944 0 0 if ($ocsp_result->[0] > 0) { }
0 0 elsif ($ocsp_result->[0] < 0) { }
945 0 0 if $DEBUG >= 3
951 0 0 if $DEBUG >= 3
955 0 0 if $DEBUG >= 3
965 0 0 if (not %sess_cb and $ctx->{'session_cache'} and my $session = &Net::SSLeay::get1_session($ssl))
988 0 94 if ($af == 10) { }
1008 67 0 unless ($socket)
1010 0 67 if $DEBUG >= 2
1012 0 67 if $DEBUG >= 2
1016 19 48 if (defined $sh and not $sh)
1018 0 19 if $DEBUG >= 2
1019 0 19 wantarray ? :
1023 4 44 unless $self->accept_SSL($socket)
1024 0 44 if $DEBUG >= 2
1026 2 42 wantarray ? :
1034 67 0 if ($socket != $self) { }
0 0 elsif ($usebio and not $biosock) { }
1035 0 67 if $usebio
1046 48 87 @_ && UNIVERSAL::isa($_[0], 'IO::Handle') ? :
1047 9 126 @_ > 1 ? :
1050 132 3 unless (do { *$self }->{'_SSL_opening'})
1051 0 132 if $DEBUG >= 2
1052 48 84 if $socket != $self
1058 0 132 if $use_threads
1063 2 130 if (do { *$socket }->{'_SSL_bio_socket'}) { }
1066 0 130 unless defined $fileno
1068 0 130 unless &Net::SSLeay::set_fd($ssl, $fileno)
1072 0 132 if $DEBUG >= 2 or do { *$self }->{'_SSL_msg_callback'}
1083 9 126 exists $args->{'Timeout'} ? :
1084 14 121 if (defined $timeout and $timeout > 0 and $socket->blocking(0)) { }
1090 121 0 if $auto_retry
1100 0 158 if $DEBUG >= 3
1101 44 114 if ($rv < 0) { }
0 114 elsif ($rv == 0) { }
1103 6 38 if (not $err and $dobio)
1104 6 0 if &$dobio($self, $SSL_ERROR == "SSL wants a read first", $SSL_ERROR == "SSL wants a write first", \$err)
1109 17 21 if ($err)
1118 3 18 unless defined $timeout
1122 18 0 if ($timeout > 0) { }
1125 0 0 $SSL_ERROR == 98381957084376 ? :
18 0 $SSL_ERROR == 98381957083872 ? :
1132 1 17 unless ($rv)
1155 0 114 if $DEBUG >= 2
1159 12 102 if (defined $timeout)
1178 0 4 unless my $ssl = do { *$self }->{'_SSL_object'}
1188 0 42 unless my $biosock = do { *$self }->{'_SSL_bio_socket'}
1192 14 0 if ($wbuf eq "")
1194 0 14 if (not defined $buf or $buf eq '') { }
1201 14 0 if ($n) { }
0 0 elsif (not defined $n) { }
1206 0 0 unless $!{'EAGAIN'} or $!{'EWOULDBLOCK'}
1219 12 30 unless $read
1226 0 30 unless $n
1232 0 30 unless $n
1236 0 30 unless &Net::SSLeay::BIO_write($rbio, $rbuf) > 0
1242 0 0 if (defined $n) { }
0 0 elsif ($!{'EAGAIN'} or $!{'EWOULDBLOCK'}) { }
1258 0 0 if $DEBUG >= 2
1267 0 0 if $DEBUG >= 2
1269 0 0 if (my $cb = do { *$self }->{'_SSL_msg_callback'})
1280 0 0 if (@_)
1281 0 0 if ($_[0]) { }
1283 0 0 unless $ssleay_set_msg_callback
1293 0 0 if ($ssleay_set_msg_callback and my $ssl = do { *$self }->{'_SSL_object'})
1295 0 0 $DEBUG >= 2 || do { *$self }->{'_SSL_msg_callback'} ? :
1304 212 492 if @_ and $auto_retry
1305 12 692 if (my $biosock = do { *$self }->{'_SSL_bio_socket'}) { }
1320 6199 36 if defined $data
1322 36 0 defined $err ? :
1323 12 24 unless ($err)
1324 8 4 unless defined $dobio
1325 10 2 if ($dobio)
1327 10 0 if &$dobio($self, 1, $SSL_ERROR == "SSL wants a write first", \$err)
1329 2 0 unless $err
1334 8 0 if (not $! and $err == $Net_SSLeay_ERROR_SSL || $err == $Net_SSLeay_ERROR_SYSCALL)
1346 6176 31 unless defined $$buffer
1348 1 6206 if ($offset > length $$buffer)
1353 14 7 unless ($length or $justpeek)
1355 7 7 if ($status & 2)
1356 3 4 if ($status & 1) { }
1 3 elsif (my $cb = do { *$self }->{'_SSL_arguments'}{'SSL_on_peer_shutdown'}) { }
1370 1 2 if $dobio
1400 0 3 if ($biosock and UNIVERSAL::can($biosock, 'peek')) { }
1406 0 3 unless defined $rv
1407 1 2 if $buf eq ""
1415 6 0 if (my $ssl = !$rc && do { *$self }->{'_SSL_object'})
1416 5 1 $self->blocking ? :
1421 0 0 if $rc < 0
1424 0 0 if (my $biosock = do { *$self }->{'_SSL_bio_socket'}) { }
1427 0 0 $rc ? :
1435 6132 3 if (my $ssl = !$rc && do { *$self }->{'_SSL_object'})
1439 2 1 if $rc < 0
1442 1 0 if (my $biosock = do { *$self }->{'_SSL_bio_socket'}) { }
1445 0 0 $rc ? :
1452 87 6 if (my $ssl = !$rc && do { *$self }->{'_SSL_object'})
1456 1 5 if $rc < 0
1460 0 5 if $fd and UNIVERSAL::can($fd, "peek")
1463 0 5 unless defined CORE::recv($fd, my $buf, $_[1], 2)
1464 0 5 $_[2] ? :
1476 0 9315 if $offset > $buf_len
1478 0 9315 if $offset == $buf_len
1483 63 9252 if ($write_all) { }
1484 0 63 $length < $buf_len - $offset ? :
1487 0 63 if not $written and $errs
1491 4 9248 if $written <= 0
1493 4 9311 unless (defined $written)
1494 2 2 if (my $err = $self->_skip_rw_error($ssl, -1))
1496 2 0 if $err == $Net_SSLeay_ERROR_SYSCALL
1501 4 9311 if (my $dobio = do { *$self }->{'_SSL_bio_sub'})
1507 0 4 !defined($written) ? :
0 4 if &$dobio($self, $wr, !defined($written) ? 2 : 1, \$err) >= 2
1508 0 4 if ($err)
1522 64 0 if (my $ssl = !$wc && do { *$self }->{'_SSL_object'})
1527 0 0 if ($wc < 0)
1533 0 0 if (my $biosock = do { *$self }->{'_SSL_bio_socket'}) { }
1536 0 0 $wc ? :
1545 9251 6 if (my $ssl = !$wc && do { *$self }->{'_SSL_object'})
1550 2 4 if ($wc < 0)
1556 2 2 if (my $biosock = do { *$self }->{'_SSL_bio_socket'}) { }
1559 2 0 $wc ? :
1576 2 0 if $self->read($buffer, 1, 0)
1581 0 91 unless do { *$self }->{'_SSL_object'}
1583 7 84 if (not defined $/ or wantarray)
1589 0 14 if (not defined $rv) { }
7 7 elsif (not $rv) { }
1590 0 0 if $! == 4
1591 0 0 if $! == 11 or $! == 11
1598 2 5 if (not defined $/) { }
1 4 elsif (ref $/) { }
1 3 elsif ($/ eq '') { }
1602 0 1 unless $size > 0
1612 1 83 if (ref $/)
1615 0 1 unless $size > 0
1619 0 1 if (not defined $rv) { }
0 1 elsif (not $rv) { }
1620 0 0 if $! == 4
1621 0 0 if $! == 11 or $! == 11
1630 1 82 $/ eq '' ? :
1635 0 83 unless my $ssl = $self->_get_ssl_object
1642 25 62 if (not defined $poke or $poke eq "")
1643 1 24 if $! == 4
1652 62 24 if ($pending and (my $pb = &Net::SSLeay::peek($ssl, $pending)) ne '') { }
1656 23 1 $buf eq '' ? :
1658 62 0 unless ($eod)
1660 3 59 if ($pos < 0) { }
1667 59 3 if ($eod)
1668 1 58 if ($delim1 ne "")
1679 62 0 if ($self->sysread(my $p, $skip, 0))
1683 0 0 unless $! == 4
1686 59 0 if ($eod and $delim1 eq '' || $eod < length $buf)
1696 0 275 ref $_[0] eq 'HASH' ? :
1698 1 274 unless $self->stop_SSL("SSL_fast_shutdown", 1, %$close_args, "_SSL_ioclass_downgrade", 0)
1704 64 210 unless ($close_args->{'_SSL_in_DESTROY'})
1714 3 20 unless do { *$self }->{'_SSL_object'}
1716 2 18 do { *$self }->{'_SSL_read_closed'} ? :
4 16 do { *$self }->{'_SSL_write_closed'} ? :
1721 0 332 ref $_[0] eq 'HASH' ? :
1722 2 330 unless do { *$self }->{'_SSL_opened'}
1725 329 3 if (my $ssl = do { *$self }->{'_SSL_object'})
1726 0 329 if (delete do { *$self }->{'_SSL_opening'}) { }
115 214 elsif (not $stop_args->{'SSL_no_shutdown'}) { }
1734 0 108 exists $stop_args->{'Timeout'} ? :
7 108 !$self->blocking ? :
1735 3 112 if ($timeout)
1741 63 14 if ($status & 1 and $status & 2 || $stop_args->{'SSL_fast_shutdown'})
1748 51 76 if ((do { *$self }->{'_SSL_opened'} || 0) <= 0)
1760 7 71 if $dobio
1761 3 75 if ($rv < 0)
1763 3 0 unless ($timeout)
1765 2 1 if (not $err and $dobio)
1766 2 0 if &$dobio($self, $SSL_ERROR == "SSL wants a read first", $SSL_ERROR == "SSL wants a write first", \$err)
1771 1 0 if ($err)
1773 1 0 if $err == $Net_SSLeay_ERROR_SYSCALL
1783 0 0 if $wait <= 0
1786 0 0 if ($err == $Net_SSLeay_ERROR_WANT_READ) { }
0 0 elsif ($err == $Net_SSLeay_ERROR_WANT_WRITE) { }
1791 0 0 if ($err)
1793 0 0 if $err == $Net_SSLeay_ERROR_SYSCALL
1801 15 60 if $rv > 0
1803 3 111 if $timeout
1804 73 41 unless ($status & 2)
1817 2 256 if ($stop_args->{'SSL_ctx_free'} and my $ctx = delete do { *$self }->{'_SSL_ctx'})
1823 48 210 unless ($stop_args->{'_SSL_in_DESTROY'})
1824 4 44 $dobio ? :
1825 31 17 if ($downgrade or not defined $downgrade)
1827 24 7 if (my $orig_class = delete do { *$self }->{'_SSL_ioclass_upgraded'})
1832 24 0 if @sslkeys
1842 558 88 if (@except)
1850 10 636 if (do { *$self }->{'_SSL_bio_socket'})
1851 1 9 unless @except
1852 9 1 if (not $keys->{'_SSL_bio_socket'}) { }
1861 306 340 if ($keys->{'_SSL_object'} and my $ssl = do { *$self }->{'_SSL_object'})
1868 32 614 if ($keys->{'_SSL_certificate'} and my $cert = delete do { *$self }->{'_SSL_certificate'})
1877 0 646 if exists do { *$self }->{'_SSL_opened'}
1880 303 343 if $untie and not do { *$self }->{'_SSL_bio_socket'}
1888 9271 142 defined $fn ? :
1916 0 1 if (my $outer = do { *$self }->{'_SSL_bio_socket'})
1917 0 0 if UNIVERSAL::can($outer, "pending")
1924 0 160 unless ref $socket
1925 1 159 @_ == 1 ? :
1926 11 149 exists $arg_hash->{'Timeout'} ? :
1930 160 0 UNIVERSAL::can($socket, 'fileno') ? :
1932 1 155 unless $usebio or defined $original_fileno
1935 4 155 if ($usebio) { }
1942 0 159 unless ($socket->configure_SSL($arg_hash))
1943 0 0 if $original_class
1948 158 1 if $class ne $original_class
1952 155 4 if (not defined $start_handshake or $start_handshake) { }
1954 0 155 if $DEBUG >= 2
1957 61 94 do { *$socket }->{'_SSL_arguments'}{'SSL_server'} ? :
1959 0 155 unless $was_blocking
1960 119 36 if ($result) { }
1964 36 0 if $original_class
1968 0 4 if $DEBUG >= 2
1976 1 0 if (length $_[0] < 4)
1978 1 0 unless length $mode
2001 0 0 if @chain and not $self->peer_certificate
2002 0 0 if (do { *$self }->{'_SSL_arguments'}{'SSL_server'})
2006 0 0 if (my $peer = &Net::SSLeay::get_peer_certificate($ssl))
2039 0 75 unless my $ssl = $self->_get_ssl_object
2042 0 0 if $reload and do { *$self }->{'_SSL_certificate'}
2044 0 75 unless my $cert = (do { *$self }->{'_SSL_certificate'} ||= &Net::SSLeay::get_peer_certificate($ssl))
2047 15 60 if ($field) { }
2048 0 15 unless my $sub = $dispatcher{$field}
2061 4 2 if ($field) { }
2062 0 4 unless my $sub = $dispatcher{$field}
2168 209 0 unless (ref $scheme)
2169 0 209 if $DEBUG >= 3
2173 0 209 unless %$scheme
2179 0 209 if $DEBUG >= 3
2181 0 209 if (my $sub = $scheme->{'callback'})
2189 12 197 if ($identity =~ /:/) { }
55 142 elsif (my(@ip) = $identity =~ /^(\d+)(?:\.(\d+)\.(\d+)\.(\d+)|[\d\.]*)$/) { }
2191 3 9 if $identity =~ /[^\da-fA-F:\.]/
2192 0 9 unless $ipn = inet_pton(10, $identity)
2195 214 6 if defined $_
3 52 if 4 != @ip or 4 != grep({$_ < 256 if defined $_;} @ip)
2199 5 137 if ($identity =~ /[^a-zA-Z0-9_.\-]/)
2200 0 5 if $identity =~ /\0/
2201 0 5 unless $identity = idn_to_ascii($identity)
2203 2 3 if $identity =~ /[^a-zA-Z0-9_.\-]/
2212 1 288 if $name eq ""
2224 116 172 if ($wtyp eq 'anywhere' and $name =~ /^([a-zA-Z0-9_\-]*)\*(.+)/) { }
26 146 elsif ($wtyp =~ /^(?:full_label|leftmost)$/ and $name =~ /^\*(\..+)$/) { }
2225 4 112 if $1 ne "" and substr($identity, 0, 4) eq "xn--"
2233 56 82 if ($identity =~ /$pattern/)
2234 56 0 unless defined $publicsuffix
2236 0 56 if $publicsuffix eq ""
2239 56 0 $tld ? :
41 15 if @labels > ($tld ? 0 + @$tld : 1)
2248 53 294 if ($ipn and $type == GEN_IPADD()) { }
201 139 elsif (not $ipn and $type == GEN_DNS()) { }
2251 46 7 if $ipn eq $name
2256 38 163 if &$check_name($name, $identity, $scheme->{'wildcards_in_alt'}, $publicsuffix)
2261 103 14 if ($scheme->{'check_cn'} eq "always" or $scheme->{'check_cn'} eq "when_only" and not $alt_dnsNames)
2263 88 15 if (not $ipn) { }
15 0 elsif ($scheme->{'ip_in_cn'}) { }
2264 44 44 if &$check_name($commonName, $identity, $scheme->{'wildcards_in_cn'}, $publicsuffix)
2267 5 10 if ($identity eq $commonName)
2270 0 0 $scheme->{'ip_in_cn'} == 6 ? :
5 0 $scheme->{'ip_in_cn'} == 4 ? :
3 2 if $scheme->{'ip_in_cn'} == 4 ? length $ipn == 4 : ($scheme->{'ip_in_cn'} == 6 ? length $ipn == 16 : 1)
2291 0 8 unless my $ssl = $self->_get_ssl_object
2298 0 21 unless $cert ||= $self->peer_certificate
2299 7 14 $key_only ? :
2307 0 21 unless my $fp = get_fingerprint_bin($self, $algo, $cert, $key_only)
2308 7 14 $key_only ? :
2318 0 34 unless my $version = &Net::SSLeay::version($ssl)
2320 0 0 $version == 65279 ? :
0 0 $version == 2 ? :
0 0 $version == 768 ? :
6 0 $version == 769 ? :
6 6 $version == 770 ? :
6 12 $version == 771 ? :
16 18 $version == 772 ? :
2351 0 0 $ctx->{'ocsp_mode'} & 8 ? :
0 0 @_ ? :
2360 52 0 $oe ? :
2368 1 50 if (defined $error_trap and ref $error_trap eq 'CODE') { }
34 16 elsif (do { *$self }->{'_SSL_ioclass_upgraded'} or do { *$self }->{'_SSL_arguments'}{'SSL_keepSocketOnError'}) { }
2373 0 34 if $DEBUG >= 3
2379 51 0 if $saved_error
2405 17 85 if not ref $self and $CURRENT_SSL_OBJECT
2406 100 2 if (ref $self) { }
2408 70 30 if (not $oe or $oe->[1] <= $severity) { }
2411 0 70 if $DEBUG
2413 0 30 if $DEBUG
2417 0 2 if $DEBUG
2428 0 52 if $DEBUG >= 2
2430 52 18 if @err
2431 70 0 if $error
2457 1 0 if $can_client_psk
2458 1 0 if $can_server_psk
2459 1 0 %can ? :
2464 0 320 unless my $self = shift()
2465 210 110 if (my $ssl = do { *$self }->{'_SSL_object'})
2467 210 0 if (not $use_threads or delete $CREATED_IN_THIS_THREAD{$ssl})
2485 0 2 ref $_[0] eq 'HASH' ? :
2537 0 0 if (ref $sub) { }
0 0 elsif ($sub eq 'use_defaults') { }
2543 0 0 $is_server ? :
2553 0 2 unless $can_npn
2560 0 2 unless $can_alpn
2582 1 0 if wantarray
2657 300 9 ref $_[0] eq 'HASH' ? :
2660 110 199 $is_server ? :
2663 6 303 if ($defaults{'SSL_reuse_ctx'})
2666 0 6 if grep {/^SSL_(?!verifycn_name|hostname)$/;} keys %$arg_hash
2668 309 0 if %defaults
2670 26 283 if (my $ctx = $arg_hash->{'SSL_reuse_ctx'})
2671 24 2 if ($ctx->isa('IO::Socket::SSL::SSL_Context')) { }
2 0 elsif (eval { do { $ctx = do { *$ctx }->{'_SSL_ctx'} } }) { }
2672 24 0 if $ctx->{'context'}
2683 6 177 if (not $is_server || defined $arg_hash->{'SSL_use_cert'} and grep {$arg_hash->{$_};} "SSL_cert", "SSL_cert_file" and grep {$arg_hash->{$_};} "SSL_key", "SSL_key_file")
2691 34 249 if ($arg_hash->{'SSL_ca'}) { }
0 249 elsif ($arg_hash->{'SSL_ca_path'}) { }
69 180 elsif ($arg_hash->{'SSL_ca_file'}) { }
2701 273 10 unless defined $arg_hash->{'SSL_use_cert'}
2713 0 2264 if defined $arg_hash->{$_} and $arg_hash->{$_} eq ""
2716 418 148 unless defined(my $file = $arg_hash->{$_})
2717 12 136 ref $file eq 'HASH' ? :
2718 0 180 unless open my $fh, "<", $f
2723 106 177 if ($verify_mode != $Net_SSLeay_VERIFY_NONE) { }
0 177 elsif ($verify_mode ne '0') { }
2736 103 0 if (not $is_server and $verify_mode & 1 and !$vcn_scheme || $vcn_scheme ne 'none')
2746 4 183 if $vcb
2747 10 177 unless $ok
2749 87 90 if $depth != 0
2752 0 90 unless ($host)
2753 0 0 if ($vcn_scheme)
2768 17 73 unless ($rv)
2776 98 185 if ($is_server)
2777 0 98 if ($arg_hash->{'SSL_ticket_keycb'} and not $can_tckt_keycb)
2788 0 1246 unless m[^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1(?:_?[123])?))$]i
2792 963 283 if ($not) { }
2795 0 283 if $ver and $v ne $ver
2803 12 256 $ver eq 'TLSv1_2' ? :
2 268 $ver eq 'TLSv1_1' ? :
2 270 $ver eq 'TLSv1' ? :
1 272 $ver eq 'SSLv3' ? :
0 273 $ver eq 'SSLv2' ? :
10 273 $ver eq 'TLSv1_3' ? :
1 282 unless my $ctx_new_sub = $ver eq "TLSv1_3" ? $CTX_tlsv1_3_new : UNIVERSAL::can("Net::SSLeay", $ver eq "SSLv2" ? "CTX_v2_new" : ($ver eq "SSLv3" ? "CTX_v3_new" : ($ver eq "TLSv1" ? "CTX_tlsv1_new" : ($ver eq "TLSv1_1" ? "CTX_tlsv1_1_new" : ($ver eq "TLSv1_2" ? "CTX_tlsv1_2_new" : "CTX_new")))))
2817 98 184 if ($is_server)
2820 203 189 unless my $val = $arg_hash->{$opt}
2821 12 177 if (ref $val eq "HASH")
2828 2 20 $host =~ /%/ ? :
2831 276 6 unless %ctx
2836 2 296 if ($host =~ /^([^%]*)%/)
2837 0 2 unless $ctx = $ctx{$1}
2839 0 2 if (my(@k) = grep({not /^SSL_(?:cert|key)(?:_file)?$/;} keys %$arg_hash))
2844 0 2 unless $can_multi_cert
2850 0 296 unless $ctx = &$ctx_new_sub()
2852 0 296 if $use_threads
2856 108 188 if $arg_hash->{'SSL_honor_cipher_order'}
2858 20 276 if ($ver eq "SSLv23" and not $ssl_op & $SSL_OP_NO{'SSLv3'})
2868 296 0 if $check_partial_chain
2874 9 287 if ($arg_hash->{'SSL_server'} and my $id = $arg_hash->{'SSL_session_id_context'} || $arg_hash->{'SSL_verify_mode'} & 1 && "$ctx")
2887 0 296 $arg_hash->{'SSL_mode_release_buffers'} ? :
2890 3 293 if (my $proto_list = $arg_hash->{'SSL_npn_protocols'})
2891 0 3 unless $can_npn
2893 2 1 if ($arg_hash->{'SSL_server'}) { }
2903 3 293 if (my $proto_list = $arg_hash->{'SSL_alpn_protocols'})
2904 0 3 unless $can_alpn
2906 2 1 if ($arg_hash->{'SSL_server'}) { }
2913 0 296 if ($arg_hash->{'SSL_ticket_keycb'})
2915 0 0 ref $cb eq 'CODE' ? :
2919 15 281 if ($arg_hash->{'SSL_psk'})
2921 1 14 if ($arg_hash->{'SSL_server'}) { }
2922 0 1 unless $can_server_psk
2926 0 0 if (ref $psk eq 'HASH') { }
2935 0 14 unless $can_client_psk
2940 0 14 if (ref $psk eq 'HASH') { }
12 2 elsif (ref $psk) { }
2941 0 0 unless defined $hint
2942 0 0 unless $p = $psk->{$hint}
2960 117 179 if ($arg_hash->{'SSL_ca'} or defined $arg_hash->{'SSL_ca_file'} or defined $arg_hash->{'SSL_ca_path'}) { }
179 0 elsif (my(%ca) = IO::Socket::SSL::default_ca()) { }
2964 0 117 if ref $file eq "SCALAR" and not $$file
2966 0 117 if ref $dir eq "SCALAR" and not $$dir
2967 34 83 if ($arg_hash->{'SSL_ca'})
2970 0 37 unless &Net::SSLeay::X509_STORE_add_cert($store, $_)
2975 0 117 if ref $dir
2976 0 117 if ($file || $dir and not &Net::SSLeay::CTX_load_verify_locations($ctx, scalar($file || ''), scalar($dir || '')))
2978 0 0 if $verify_mode != $Net_SSLeay_VERIFY_NONE
2985 0 179 if ref $dir
2986 0 179 if (not &Net::SSLeay::CTX_load_verify_locations($ctx, scalar($ca{'SSL_ca_file'} || ''), scalar($dir || '')) and $verify_mode != $Net_SSLeay_VERIFY_NONE)
2994 9 287 if ($is_server and $verify_mode & $Net_SSLeay_VERIFY_PEER)
2995 0 9 if ($arg_hash->{'SSL_client_ca'})
2997 0 0 unless &Net::SSLeay::CTX_add_client_CA($ctx, $_)
3002 0 9 if ($arg_hash->{'SSL_client_ca_file'})
3004 0 0 unless my $list = &Net::SSLeay::load_client_CA_file($arg_hash->{'SSL_client_ca_file'})
3012 0 296 if ($arg_hash->{'SSL_check_crl'})
3014 0 0 if ($arg_hash->{'SSL_crl_file'})
3018 0 0 if ($crl) { }
3028 296 0 if $X509_STORE_flags
3033 12 284 if $arg_hash->{'SSL_passwd_cb'}
3037 31 267 if (my $x509 = $arg_hash->{'SSL_cert'}) { }
88 179 elsif (my $f = $arg_hash->{'SSL_cert_file'}) { }
3041 1 30 ref $x509 eq 'ARRAY' ? :
3043 0 31 unless &Net::SSLeay::CTX_use_certificate($ctx, $cert)
3046 0 1 unless &Net::SSLeay::CTX_add_extra_chain_cert($ctx, $ca)
3053 85 3 if (&Net::SSLeay::CTX_use_certificate_chain_file($ctx, $f)) { }
1 2 elsif (do { push @err, ['PEM', _errstack()]; &Net::SSLeay::CTX_use_certificate_file($ctx, $f, 2) }) { }
3064 1 0 if (not $cert and $arg_hash->{'SSL_passwd_cb'} and defined(my $pw = $arg_hash->{'SSL_passwd_cb'}->(0)))
3069 0 2 unless &Net::SSLeay::CTX_use_certificate($ctx, $cert)
3077 0 0 unless &Net::SSLeay::CTX_add_extra_chain_cert($ctx, $ca)
3080 0 2 if $key and not &Net::SSLeay::CTX_use_PrivateKey($ctx, $key)
3084 2 0 if $key
3085 2 0 if $cert
3086 2 0 if $key
3090 0 88 unless ($havecert)
3095 0 0 if @e
3101 181 117 if (not $havecert or $havekey) { }
28 89 elsif (my $pkey = $arg_hash->{'SSL_key'}) { }
89 0 elsif (my $f = $arg_hash->{'SSL_key_file'} || ($havecert eq 'PEM' ? $arg_hash->{'SSL_cert_file'} : undef)) { }
3105 0 28 unless &Net::SSLeay::CTX_use_PrivateKey($ctx, $pkey)
3111 89 1 if (&Net::SSLeay::CTX_use_PrivateKey_file($ctx, $f, $ft))
3112 88 1 $ft == 1 ? :
3116 0 89 unless $havekey
3120 8 176 if not $is_server and $can_pha and $havecert and $havekey
3124 98 184 if ($arg_hash->{'SSL_server'})
3126 0 98 if (my $f = $arg_hash->{'SSL_dh_file'}) { }
98 0 elsif (my $dh = $arg_hash->{'SSL_dh'}) { }
3131 0 0 unless $dh
3134 0 0 unless $rv = &Net::SSLeay::CTX_set_tmp_dh($_, $dh)
3137 0 0 unless $rv
3142 0 112 unless &Net::SSLeay::CTX_set_tmp_dh($_, $dh)
3148 10 272 if (my $curve = $arg_hash->{'SSL_ecdh_curve'})
3149 0 10 unless $can_ecdh
3154 0 10 if ($arg_hash->{'SSL_server'} and $curve eq 'auto') { }
10 0 elsif ($set_groups_list) { }
0 0 elsif ($curve =~ /:/) { }
0 0 elsif ($arg_hash->{'SSL_server'}) { }
3155 0 0 if ($can_ecdh eq 'can_auto') { }
0 0 elsif ($can_ecdh eq 'auto') { }
3156 0 0 unless Net::SSLeay::CTX_set_ecdh_auto($_, 1)
3167 0 10 unless &$set_groups_list($_, $curve)
3170 0 10 if $can_ecdh eq "can_auto"
3176 0 0 unless ($curve =~ /^\d+$/)
3182 0 0 unless my $ecdh = &Net::SSLeay::EC_KEY_new_by_curve_name($curve)
3186 0 0 unless &Net::SSLeay::CTX_set_tmp_ecdh($_, $ecdh)
3197 11 271 if (my $fp = $arg_hash->{'SSL_fingerprint'})
3198 2 9 ref $fp ? :
3199 0 13 unless my($algo, $pubkey, $digest) = /^(?:([\w-]+)\$)?(pub\$)?([a-f\d:]+)$/i
3202 0 0 length $digest == 64 ? :
0 0 length $digest == 40 ? :
0 0 length $digest == 32 ? :
3222 2 12 $_->[1] ? :
3228 1 3 $force ? :
3249 0 282 if ($^O eq "darwin")
3254 0 0 $vcb ? :
3255 0 0 if ($rv != 1)
3266 173 11 if (not $is_server and $can_ocsp_staple and not $verify_fingerprint)
3270 0 80 unless my $iossl = $SSL_OBJECT{$ssl}
3272 0 80 if ($iossl->[1])
3283 0 80 if ($staple_callback)
3289 80 0 unless ($resp)
3290 0 80 if $IO::Socket::SSL::DEBUG >= 3
3293 0 0 if $IO::Socket::SSL::DEBUG >= 3
3295 0 0 if ($status != Net::SSLeay::OCSP_RESPONSE_STATUS_SUCCESSFUL())
3296 0 0 if $IO::Socket::SSL::DEBUG >= 3
3300 0 0 unless (eval { do { &Net::SSLeay::OCSP_response_verify($ssl, $resp) } })
3301 0 0 if $IO::Socket::SSL::DEBUG >= 3
3308 0 0 unless ($certid)
3309 0 0 if $IO::Socket::SSL::DEBUG >= 3
3314 0 0 if ($status and $status->[2])
3316 0 0 if (not $status->[1]) { }
0 0 elsif ($status->[2]{'statusType'} == Net::SSLeay::V_OCSP_CERTSTATUS_GOOD()) { }
3318 0 0 if $cache
3323 0 0 if $cache
3330 0 0 if $cache
3339 0 0 if ($hard_error) { }
0 0 elsif (@results and $chain[0] == $iossl->peer_certificate) { }
3349 282 0 if (my $cl = $arg_hash->{'SSL_cipher_list'})
3353 0 296 ref $cl ? :
0 296 unless &Net::SSLeay::CTX_set_cipher_list($ctx{$_}, scalar(ref $cl ? $cl->{$_} || $cl->{''} || $DEFAULT_SSL_ARGS{'SSL_cipher_list'} || (next) : $cl))
3357 0 282 if (my $cl = $arg_hash->{'SSL_ciphersuites'})
3358 0 0 unless $can_ciphersuites
3363 0 0 ref $cl ? :
0 0 unless &Net::SSLeay::CTX_set_ciphersuites($ctx{$_}, scalar(ref $cl ? $cl->{$_} || $cl->{''} || $DEFAULT_SSL_ARGS{'SSL_cipher_list'} || (next) : $cl))
3370 6 276 if (keys %ctx > 1 or not exists $ctx{''})
3371 0 6 unless $can_server_sni
3377 4 15 unless defined $host
3378 0 19 unless (my $snictx = $ctx{lc $host} || $ctx{''})
3379 0 0 if $IO::Socket::SSL::DEBUG > 1
3383 0 19 if $IO::Socket::SSL::DEBUG > 1
3384 9 10 if $snictx != $ctx
3389 0 282 if (my $cb = $arg_hash->{'SSL_create_ctx_callback'})
3397 106 176 $self->{'verify_mode'} ? :
0 282 defined $arg_hash->{'SSL_ocsp_mode'} ? :
3399 0 282 if $IO::Socket::SSL::DEBUG >= 3
3401 0 282 if (my $cache = $arg_hash->{'SSL_session_cache'}) { }
3 279 elsif (my $size = $arg_hash->{'SSL_session_cache_size'}) { }
3409 3 279 if ($self->{'session_cache'} and %sess_cb)
3420 0 15 unless (my $key = $args->{'SSL_session_key'})
3424 0 15 if $IO::Socket::SSL::DEBUG >= 3
3430 0 12 if $IO::Socket::SSL::DEBUG >= 3
3447 280 3 if (my $ctx = $self->{'context'})
3448 0 280 if $IO::Socket::SSL::DEBUG >= 3
3449 280 0 if (not $use_threads or delete $CTX_CREATED_IN_THIS_THREAD{$ctx})
3451 105 175 if ($self->{'verify_mode'})
3452 0 105 if $IO::Socket::SSL::DEBUG >= 3
3455 0 280 if ($self->{'ocsp_error_ref'})
3456 0 0 if $IO::Socket::SSL::DEBUG >= 3
3459 0 280 if $IO::Socket::SSL::DEBUG >= 3
3487 0 3 unless $size > 0
3502 0 19 if $IO::Socket::SSL::DEBUG >= 3
3518 1 12 $key ? :
3522 3 15 if (not $session) { }
12 3 elsif ($v->[0] == $session) { }
3529 1 5 if $v == $head
3531 0 0 $key ? :
0 0 $session ? :
0 13 if $IO::Socket::SSL::DEBUG >= 3
3537 12 3 if $_->[0]
3549 3 13 if ($session)
3552 0 3 if $IO::Socket::SSL::DEBUG >= 3
3553 3 0 if $v->[0] == $session
3555 0 0 if $v == $shead
3560 11 5 if $v
3562 0 0 $session ? :
0 0 $v ? :
0 16 if $IO::Socket::SSL::DEBUG >= 3
3578 27 11 if ($$rhead) { }
3594 1 18 if ($self->{'room'} < 0)
3597 0 1 if $l->[0]
3611 0 32 unless $$rhead
3614 5 27 if ($v != $$rhead) { }
7 20 elsif ($v->[$inext] == $v) { }
3618 4 3 if ($inext == 4) { }
3641 0 22 unless $$rhead
3642 16 6 if $$rhead == $v
3663 0 0 if exists $v2i{$v}
3666 0 0 if $v == $self->{'ghead'}
3676 0 0 if $v == $self->{'ghead'}
3688 0 0 if $v == $shead
3699 0 0 if $v->[0]
3718 0 0 unless my $e = $self->{$id}
3720 0 0 if ($e->{'expire'} and time < $e->{'expire'})
3724 0 0 if ($e->{'nextUpdate'} and time < $e->{'nextUpdate'})
3736 0 0 if ($del > 0)
3758 0 0 unless (my $uri = &Net::SSLeay::P_X509_get_ocsp_uri($cert))
3759 0 0 if $IO::Socket::SSL::DEBUG > 2
3763 0 0 unless (my $certid = eval { do { &Net::SSLeay::OCSP_cert2ids($ssl, $cert) } })
3764 0 0 if $IO::Socket::SSL::DEBUG > 2
3768 0 0 if (not $done = $cache->get($certid)) { }
0 0 elsif ($done->{'hard_error'}) { }
0 0 elsif ($done->{'soft_error'}) { }
3785 0 0 unless %todo
3786 0 0 @soft_error ? :
3811 0 0 if not $todo or $self->{'error'}
3816 0 0 if (not $resp) { }
0 0 elsif (not eval { do { $resp = &Net::SSLeay::d2i_OCSP_RESPONSE($resp) } }) { }
0 0 elsif ((my $status = &Net::SSLeay::OCSP_response_status($resp)) != Net::SSLeay::OCSP_RESPONSE_STATUS_SUCCESSFUL()) { }
0 0 elsif (not eval { do { $req = &Net::SSLeay::d2i_OCSP_REQUEST($todo->{'req'}); &Net::SSLeay::OCSP_response_verify($self->{'ssl'}, $resp, $req) } }) { }
0 0 elsif (my(@result) = &Net::SSLeay::OCSP_response_results($resp, @{$$todo{'ids'};})) { }
3848 0 0 if ($@) { }
3856 0 0 unless @soft_error
3869 0 0 if ($rv->[2]) { }
3871 0 0 if (not $rv->[1]) { }
0 0 elsif ($rv->[2]{'statusType'} == Net::SSLeay::V_OCSP_CERTSTATUS_GOOD()) { }
3894 0 0 if (@miss and @found)
3901 0 0 if $IO::Socket::SSL::DEBUG >= 2
3913 0 0 if $req
3914 0 0 if ($self->{'failhard'})
3918 0 0 if (@soft_error)
3919 0 0 if $self->{'soft_error'}
3922 0 0 if (@hard_error) { }
0 0 elsif (not %{$self->{'todo'};}) { }
3935 0 0 unless eval { do { require HTTP::Tiny } }
3939 0 0 if $IO::Socket::SSL::DEBUG
3944 0 0 if $IO::Socket::SSL::DEBUG
3946 0 0 if defined $self->add_response($uri, $resp->{'success'} && $resp->{'content'})
3950 0 0 if $IO::Socket::SSL::DEBUG >= 2
4085 0 0 unless $IO::Socket::SSL::DEBUG >= 2
4097 0 0 if ($ssl_ver and $content_type != $trace_constants{'SSL3_RT_HEADER'} and $content_type != $trace_constants{'SSL3_RT_INNER_CONTENT_TYPE'})
4110 0 0 $ssl_ver == $trace_constants{'SSL3_VERSION_MAJOR'} && $content_type ? :
4115 0 0 if ($content_type == $trace_constants{'SSL3_RT_CHANGE_CIPHER_SPEC'}) { }
0 0 elsif ($content_type == $trace_constants{'SSL3_RT_ALERT'}) { }
4126 0 0 $direction ? :