Branch Coverage

blib/lib/Crypt/LE.pm
Criterion Covered Total %
branch 175 536 32.6


line true false branch
310 2 16 if exists $params{$key} and not ref $params{$key}
315 0 2 if ($self->{'server'})
320 0 2 if ($self->{'dir'})
321 0 0 unless $self->{'dir'} =~ m[^https?://]i
323 2 0 unless ($self->{'server'})
324 0 2 $self->{'live'} ? :
327 0 2 if $params{'logger'} and &blessed($params{'logger'})
347 1 3 unless $key
351 1 2 if $@
366 0 1 unless $pk
396 1 10 unless $csr
398 0 10 unless $bio
400 1 9 unless (&Net::SSLeay::BIO_write($bio, $csr) and $in = &Net::SSLeay::PEM_read_bio_X509_REQ($bio))
405 9 0 if ($cn)
407 9 0 if $cn and $cn =~ /^.*?\bCN=([^\s,]+).*$/
411 9 0 if ($i > -1)
413 9 0 if ($o)
416 9 0 if ($dec)
418 9 0 if ($ext->{'extnID'} and $ext->{'extnID'} eq '2.5.29.17')
430 9 0 if ($cn)
434 9 0 if ($san)
436 21 0 if ($ext->{'dNSName'}) { }
438 12 9 unless $seen{$cn}++
445 0 9 if ($san_broken)
448 9 0 if (@loaded_domains) { }
451 1 8 if (my $odd = $self->_verify_list(\@loaded_domains))
456 4 4 if (@list)
457 2 2 unless join(',', sort(@loaded_domains)) eq join(',', sort(@list))
480 1 13 unless @list
481 4 9 if (my $odd = $self->_verify_list(\@list))
485 3 6 unless $key
487 0 6 unless $csr
515 2 1 unless $key
540 0 0 unless ($email)
548 0 0 unless $email
564 1 8 unless @list
565 4 4 if (my $odd = $self->_verify_list(\@list))
584 0 1 unless defined $version and $version =~ /^\d+$/ and $version <= 2
614 0 3 if $self->_is_divisible($n)
622 0 3 if ($self->{'autodir'})
624 0 0 unless $status == 0
635 0 399 if $remainder->is_zero
657 24 7 $list ? :
1 31 ref $list eq 'ARRAY' ? :
662 42 7 unless m"[\s\[\{\(\<\@\>\)\}\]/\\:]" or /^[\d\.]+$/
663 9 21 @odd ? :
688 1 0 if (not $self->{'directory'} or $reload)
689 0 1 $self->{'dir'} ? :
690 1 0 if ($status == 200 and $content and ref $content eq 'HASH') { }
691 1 0 if ($content->{'newAccount'}) { }
0 0 elsif ($content->{'new-reg'}) { }
692 0 1 $self->version ? :
699 0 0 $self->version ? :
707 0 0 if $self->{'directory'} and $self->{'directory'}{'reg'}
709 1 0 unless ($self->{'nonce'})
710 1 0 if ($self->{'directory'}{'newNonce'}) { }
712 0 1 unless $self->{'nonce'}
752 0 0 if $self->{'email'}
754 0 0 if $self->{'location'}
756 0 0 if ($status == $self->_compat_response(409)) { }
0 0 elsif ($status == 201) { }
760 0 0 if ($status == $self->_compat_response(202)) { }
762 0 0 if ($self->version == 1 and $self->{'links'} and $self->{'links'}{'terms-of-service'} and !$content->{'agreement'} || $self->{'links'}{'terms-of-service'} ne $content->{'agreement'}) { }
763 0 0 $content->{'agreement'} ? :
776 0 0 if ($self->{'links'}{'terms-of-service'})
784 0 0 if ($self->{'registration_info'} and ref $self->{'registration_info'} eq 'HASH')
786 0 0 if ($self->{'registration_info'}{'contact'} and ref $self->{'registration_info'}{'contact'} eq 'ARRAY' and @{$self->{'registration_info'}{'contact'};})
790 0 0 if (not $self->{'registration_id'} and $self->{'directory'}{'reg'} =~ m[/([^/]+)$])
793 0 0 if $self->{'registration_id'}
807 0 0 unless $self->tos_changed
809 0 0 $status == $self->_compat_response(202) ? :
823 0 0 unless $contacts and ref $contacts eq 'ARRAY'
824 0 0 /^\w+:/ ? :
826 0 0 $status == $self->_compat_response(202) ? :
840 0 0 unless $self->{'domains'}
846 0 0 if ($self->version > 1) { }
847 0 0 unless ($self->{'authz'})
849 0 0 if ($status == 201 and $content->{'identifiers'} and $content->{'authorizations'}) { }
853 0 0 unless ($self->{'directory'}{'new-authz'})
866 0 0 if ($status == $self->_compat_response(201)) { }
868 0 0 unless $content->{'identifier'} and $content->{'identifier'}{'value'}
870 0 0 if $content->{'wildcard'}
872 0 0 unless ($challenge and ref $challenge eq 'HASH' and $challenge->{'type'} and $challenge->{'url'} || $challenge->{'uri'} and $challenge->{'status'} || $content->{'status'})
879 0 0 unless ($challenge->{'token'} and $challenge->{'token'} =~ /$url_safe/)
883 0 0 if $challenge->{'status'} eq 'valid'
888 0 0 if ($self->{'challenges'} and exists $self->{'challenges'}{$domain}) { }
903 0 0 if (%domains_failed) { }
907 0 0 @failed == $domains_requested ? :
914 0 0 unless (defined $self->{'domains'}{$domain})
919 0 0 $domains_requested ? :
999 0 0 unless $self->{'domains'} and $self->{'challenges'}
1000 0 0 $cb && &blessed($cb) ? :
1003 0 0 unless $cb and ref $cb eq 'CODE' || $mod_callback && $cb->can($handler)
1004 0 0 if $params and ref $params ne 'HASH'
1008 0 0 unless (defined $self->{'domains'}{$domain} and not $self->{'domains'}{$domain})
1009 0 0 $self->{'domains'}{$domain} ? :
1012 0 0 unless ($self->{'challenges'}{$domain} and $self->{'challenges'}{$domain}{$type})
1026 0 0 $mod_callback ? :
1028 0 0 if ($@ or not $rv) { }
1029 0 0 $@ ? :
1036 0 0 if (@domains_failed) { }
1038 0 0 $domains_accepted ? :
1042 0 0 $domains_accepted ? :
1129 0 0 unless $self->{'domains'} and $self->{'challenges'}
1130 0 0 unless $self->{'active_challenges'}
1131 0 0 $cb && &blessed($cb) ? :
1134 0 0 if ($cb)
1135 0 0 unless $cb and ref $cb eq 'CODE' || $mod_callback && $cb->can($handler)
1136 0 0 if $params and ref $params ne 'HASH'
1141 0 0 unless (defined $self->{'domains'}{$domain} and not $self->{'domains'}{$domain})
1142 0 0 $self->{'domains'}{$domain} ? :
1145 0 0 unless ($self->{'active_challenges'}{$domain})
1154 0 0 if ($status == $expected_status)
1156 0 0 if ($content->{'uri'})
1158 0 0 if $self->version > 1
1163 0 0 if $self->{'try'} and ++$try == $self->{'try'}
1165 0 0 if ($status == $expected_status and $content and $content->{'status'})
1166 0 0 if ($content->{'status'} =~ /^(?:in)?valid$/)
1167 0 0 if ($content->{'status'} eq 'valid')
1175 0 0 if ($cb)
1187 0 0 $mod_callback ? :
1189 0 0 if ($@ or not $rv)
1191 0 0 $@ ? :
1192 0 0 if $validated
1196 0 0 if ($validated) { }
1200 0 0 unless $cb_reset
1204 0 0 if (@domains_failed) { }
1206 0 0 $domains_verified ? :
1210 0 0 $domains_verified ? :
1223 0 0 unless $self->{'csr'}
1228 0 0 unless ($self->{'finalize'})
1230 0 0 $status == 403 ? :
0 0 unless $status == 201
1231 0 0 if (ref $content eq 'HASH' and $content->{'identifiers'} and $content->{'authorizations'})
1236 0 0 if ($self->{'finalize'})
1243 0 0 if $self->{'try'} and ++$try == $self->{'try'}
1245 0 0 if ($status == 200 and $content and $content->{'status'}) { }
1246 0 0 if ($content->{'status'} eq 'valid') { }
0 0 elsif ($content->{'status'} eq 'invalid') { }
0 0 elsif ($content->{'status'} eq 'pending') { }
1247 0 0 if ($content->{'certificate'}) { }
1250 0 0 if $self->version > 1
1252 0 0 unless $status == 200
1255 0 0 if ($content =~ /(\n\-+END CERTIFICATE\-+)[\s\r\n]+(.+)/s)
1275 0 0 unless $ready
1279 0 0 $self->{'links'} && $self->{'links'}{'up'} ? :
1280 0 0 $self->{'issuer_url'} ? :
1293 0 0 unless $self->{'alternatives'}
1299 0 0 if $self->version > 1
1301 0 0 unless $status == 200
1303 0 0 if ($content =~ /(\n\-+END CERTIFICATE\-+)[\s\r\n]+(.+)/s) { }
1323 0 0 if $self->issuer
1324 0 0 unless $self->{'issuer_url'}
1326 0 0 if ($status == 200)
1345 0 0 unless $crt
1349 0 0 if ($status == 200) { }
0 0 elsif ($status == 409) { }
1374 0 0 $self->{'links'} && $self->{'links'}{'terms-of-service'} ? :
1445 0 0 if ($self->{'alternative_certificates'} and defined $idx and $idx < @{$self->{'alternative_certificates'};})
1459 0 0 if ($self->{'alternative_certificates'})
1516 0 2 unless $self->{'failed_domains'} and @{$self->{'failed_domains'};}
1517 1 1 unless $all
1520 1 1 if ($proc)
1525 1 0 @rv ? :
1536 0 1 unless $self->{'domains'} and %{$self->{'domains'};}
1538 1 0 @list ? :
1556 0 2 if $params and ref $params eq 'HASH'
1557 0 2 if (not $res or $timeout and !($timeout =~ /^\d+/) || $timeout < 1) { }
2 0 elsif (ref $res or not $res =~ m[^\w+://]i) { }
1562 2 0 if (ref $res) { }
1564 0 2 unless $bio and &Net::SSLeay::BIO_write($bio, $$res)
1567 0 0 unless $bio
1569 0 2 if ($load_error) { }
1572 1 1 unless ($cert)
1590 0 0 unless $response->{'success'}
1603 0 3 unless $pem
1604 3 0 if $pem =~ /(?:^|\s+)-+BEGIN[^-]*-+\s+(.*?)\s+-+END/s
1617 3 0 $der && $type ? :
1632 1 0 unless $pkcs12_available
1633 0 0 unless $pass
1638 0 0 if $@ and $@ =~ /Usage/
1639 0 0 if $@
1661 0 1 if ($self->{'error'})
1663 0 0 ref $self->{'error'} ? :
0 0 $err ? :
1676 0 10 unless $type =~ /^\d+$/ and $type <= 1
1677 8 2 if ($type == 0) { }
2 0 elsif ($type == 1) { }
1679 2 6 if $attr < 2048 or $attr % 1024
1681 1 1 unless $attr and $attr ne 'default'
1682 0 2 unless defined &Net::SSLeay::EC_KEY_generate_key
1684 4 4 if ($key) { }
1686 0 4 unless $bio
1687 0 4 unless &Net::SSLeay::BIO_write($bio, $key)
1690 0 4 unless $pk
1693 0 4 unless $pk
1696 2 2 $type == 0 ? :
1698 1 3 if $@
1699 1 0 $@ ? :
1 3 unless $gen
1700 2 1 $type == 0 ? :
1708 0 6 unless $domains and !$ref || $ref eq 'ARRAY'
1709 0 6 if $attrib and ref $attrib ne 'HASH'
1711 0 6 unless $req
1712 0 6 unless &Net::SSLeay::X509_REQ_set_pubkey($req, $pk)
1713 6 0 $ref ? :
1714 6 0 unless $attrib and $attrib->{'CN'} || $attrib->{'commonName'}
1716 0 6 unless &Net::SSLeay::P_X509_REQ_add_extensions($req, &Net::SSLeay::NID_subject_alt_name, $list)
1718 0 6 unless $n
1721 0 30 unless &Net::SSLeay::X509_NAME_add_entry_by_txt($n, $key, scalar MBSTRING_UTF8(), scalar &encode_utf8($attrib->{$key}))
1723 0 6 unless &Net::SSLeay::X509_REQ_set_subject_name($req, $n)
1726 6 0 unless (&Net::SSLeay::X509_REQ_get_version($req))
1727 0 6 unless &Net::SSLeay::X509_REQ_set_version($req, 0)
1730 0 6 unless $md and &Net::SSLeay::X509_REQ_sign($req, $pk, $md)
1738 6 16 if $data{'r'}
1739 14 8 if $data{'b'}
1740 8 14 if $data{'k'}
1741 1 21 wantarray ? :
1748 0 6 if length($val) % 2
1759 0 2 unless ($url)
1761 0 0 wantarray ? :
1768 0 2 if (defined $payload or $method eq 'post') { }
1770 0 0 defined $payload ? :
1774 1 1 $resp->{'headers'}{'content-type'} && $resp->{'headers'}{'content-type'} =~ m[^application/(?:problem\+)?json] ? :
1775 1 1 $slurp ? :
1776 1 1 if $resp->{'headers'}{'replay-nonce'}
1778 1 1 unless ($slurp)
1782 0 1 if ($@)
1786 1 1 $resp->{'headers'}{'link'} ? :
1787 0 2 $resp->{'headers'}{'location'} ? :
1788 1 1 wantarray ? :
1793 0 3 unless $self->{'key_params'}
1804 0 0 unless defined $obj
1805 0 0 ref $obj ? :
1808 0 0 if ($url and $self->version > 1)
1809 0 0 if ($self->{'directory'}{'reg'} and not $opts->{'jwk'})
1824 0 1 unless $links
1826 0 1 ref $links eq 'ARRAY' ? :
1827 0 1 unless $link and $link =~ /^<([^>]+)>;rel="([^"]+)"$/i
1828 0 1 if ($2 eq 'alternate') { }
1840 0 1 unless $content
1842 3 4 if (my $name = $compat->{$_})
1850 0 0 $self->version == 2 ? :
1855 0 0 if not $req or $self->version == 1 or not $req->{'resource'}
1856 0 0 unless my $res = delete $req->{'resource'}
1857 0 0 if ($res eq 'new-reg' or $res eq 'reg') { }
0 0 elsif ($res eq 'new-cert') { }
1869 0 0 unless $data and $data->{'domain'}
1879 58 0 unless $self->{'debug'}
1881 0 0 if (not ref $_) { }
0 0 elsif ($self->{'debug'} > 1) { }
1882 0 0 $self->{'logger'} ? :
1884 0 0 $self->{'logger'} ? :
1892 22 24 if ($code == 0) { }
1895 0 24 if (ref $data eq 'HASH' and $data->{'error'}) { }
1901 46 0 if $data
1908 0 0 if ($err and ref $err eq 'HASH')
1909 0 0 if $err->{'error'} and $err->{'error'}{'detail'}
1910 0 0 if $err->{'detail'}
1917 0 0 unless $self->{'loaded_domains'}
1927 0 18 unless $file
1928 4 14 unless (ref $file)
1930 4 0 if (defined $fh)
1938 14 0 ref $file eq 'SCALAR' ? :
1944 1 0 unless (defined $_[5] and $_[5])
1950 1 0 unless ($@)
1953 1 0 unless $$exp and $s > $$exp
1962 2 1 !$content || $content =~ /^\-+BEGIN/ ? :