Branch Coverage

blib/lib/Crypt/LE.pm
Criterion Covered Total %
branch 162 540 30.0


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 if ($self->{'version'} > 1) { }
325 0 0 $self->{'live'} ? :
327 0 2 $self->{'live'} ? :
331 0 2 if $params{'logger'} and &blessed($params{'logger'})
351 1 3 unless $key
355 1 2 if $@
370 0 1 unless $pk
400 1 10 unless $csr
402 0 10 unless $bio
404 1 9 unless (&Net::SSLeay::BIO_write($bio, $csr) and $in = &Net::SSLeay::PEM_read_bio_X509_REQ($bio))
409 9 0 if ($cn)
411 9 0 if $cn and $cn =~ /^.*?\bCN=([^\s,]+).*$/
415 9 0 if ($i > -1)
417 9 0 if ($o)
420 9 0 if ($dec)
422 9 0 if ($ext->{'extnID'} and $ext->{'extnID'} eq '2.5.29.17')
434 9 0 if ($cn)
438 9 0 if ($san)
440 21 0 if ($ext->{'dNSName'}) { }
442 12 9 unless $seen{$cn}++
449 0 9 if ($san_broken)
452 9 0 if (@loaded_domains) { }
455 1 8 if (my $odd = $self->_verify_list(\@loaded_domains))
460 4 4 if (@list)
461 2 2 unless join(',', sort(@loaded_domains)) eq join(',', sort(@list))
484 1 13 unless @list
485 4 9 if (my $odd = $self->_verify_list(\@list))
489 3 6 unless $key
491 0 6 unless $csr
519 2 1 unless $key
544 0 0 unless ($email)
552 0 0 unless $email
568 1 8 unless @list
569 4 4 if (my $odd = $self->_verify_list(\@list))
588 0 1 unless defined $version and $version =~ /^\d+$/ and $version <= 2
618 0 3 if $self->_is_divisible($n)
626 0 3 if ($self->{'autodir'})
628 0 0 unless $status == 0
639 0 399 if $remainder->is_zero
661 24 7 $list ? :
1 31 ref $list eq 'ARRAY' ? :
666 42 7 unless m"[\s\[\{\(\<\@\>\)\}\]/\\:]" or /^[\d\.]+$/
667 9 21 @odd ? :
692 1 0 if (not $self->{'directory'} or $reload)
693 0 1 $self->{'dir'} ? :
694 1 0 if ($status == 200 and $content and ref $content eq 'HASH') { }
695 0 1 if ($content->{'newAccount'}) { }
1 0 elsif ($content->{'new-reg'}) { }
696 0 0 $self->version ? :
703 0 1 $self->version ? :
711 0 0 if $self->{'directory'} and $self->{'directory'}{'reg'}
713 0 1 unless ($self->{'nonce'})
714 0 0 if ($self->{'directory'}{'newNonce'}) { }
716 0 0 unless $self->{'nonce'}
756 0 0 if $self->{'email'}
758 0 0 if $self->{'location'}
760 0 0 if ($status == $self->_compat_response(409)) { }
0 0 elsif ($status == 201) { }
764 0 0 if ($status == $self->_compat_response(202)) { }
766 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'}) { }
767 0 0 $content->{'agreement'} ? :
780 0 0 if ($self->{'links'}{'terms-of-service'})
788 0 0 if ($self->{'registration_info'} and ref $self->{'registration_info'} eq 'HASH')
790 0 0 if ($self->{'registration_info'}{'contact'} and ref $self->{'registration_info'}{'contact'} eq 'ARRAY' and @{$self->{'registration_info'}{'contact'};})
794 0 0 if (not $self->{'registration_id'} and $self->{'directory'}{'reg'} =~ m[/([^/]+)$])
797 0 0 if $self->{'registration_id'}
811 0 0 unless $self->tos_changed
813 0 0 $status == $self->_compat_response(202) ? :
827 0 0 unless $contacts and ref $contacts eq 'ARRAY'
828 0 0 /^\w+:/ ? :
830 0 0 $status == $self->_compat_response(202) ? :
844 0 0 unless $self->{'domains'}
850 0 0 if ($self->version > 1) { }
851 0 0 unless ($self->{'authz'})
853 0 0 if ($status == 201 and $content->{'identifiers'} and $content->{'authorizations'}) { }
857 0 0 unless ($self->{'directory'}{'new-authz'})
870 0 0 if ($status == $self->_compat_response(201)) { }
872 0 0 unless $content->{'identifier'} and $content->{'identifier'}{'value'}
874 0 0 if $content->{'wildcard'}
876 0 0 unless ($challenge and ref $challenge eq 'HASH' and $challenge->{'type'} and $challenge->{'url'} || $challenge->{'uri'} and $challenge->{'status'} || $content->{'status'})
883 0 0 unless ($challenge->{'token'} and $challenge->{'token'} =~ /$url_safe/)
887 0 0 if $challenge->{'status'} eq 'valid'
892 0 0 if ($self->{'challenges'} and exists $self->{'challenges'}{$domain}) { }
907 0 0 if (%domains_failed) { }
911 0 0 @failed == $domains_requested ? :
918 0 0 unless (defined $self->{'domains'}{$domain})
923 0 0 $domains_requested ? :
1003 0 0 unless $self->{'domains'} and $self->{'challenges'}
1004 0 0 $cb && &blessed($cb) ? :
1007 0 0 unless $cb and ref $cb eq 'CODE' || $mod_callback && $cb->can($handler)
1008 0 0 if $params and ref $params ne 'HASH'
1012 0 0 unless (defined $self->{'domains'}{$domain} and not $self->{'domains'}{$domain})
1013 0 0 $self->{'domains'}{$domain} ? :
1016 0 0 unless ($self->{'challenges'}{$domain} and $self->{'challenges'}{$domain}{$type})
1030 0 0 $mod_callback ? :
1032 0 0 if ($@ or not $rv) { }
1033 0 0 $@ ? :
1040 0 0 if (@domains_failed) { }
1042 0 0 $domains_accepted ? :
1046 0 0 $domains_accepted ? :
1133 0 0 unless $self->{'domains'} and $self->{'challenges'}
1134 0 0 unless $self->{'active_challenges'}
1135 0 0 $cb && &blessed($cb) ? :
1138 0 0 if ($cb)
1139 0 0 unless $cb and ref $cb eq 'CODE' || $mod_callback && $cb->can($handler)
1140 0 0 if $params and ref $params ne 'HASH'
1145 0 0 unless (defined $self->{'domains'}{$domain} and not $self->{'domains'}{$domain})
1146 0 0 $self->{'domains'}{$domain} ? :
1149 0 0 unless ($self->{'active_challenges'}{$domain})
1158 0 0 if ($status == $expected_status)
1160 0 0 if ($content->{'uri'})
1162 0 0 if $self->version > 1
1167 0 0 if $self->{'try'} and ++$try == $self->{'try'}
1169 0 0 if ($status == $expected_status and $content and $content->{'status'})
1170 0 0 if ($content->{'status'} =~ /^(?:in)?valid$/)
1171 0 0 if ($content->{'status'} eq 'valid')
1179 0 0 if ($cb)
1191 0 0 $mod_callback ? :
1193 0 0 if ($@ or not $rv)
1195 0 0 $@ ? :
1196 0 0 if $validated
1200 0 0 if ($validated) { }
1204 0 0 unless $cb_reset
1208 0 0 if (@domains_failed) { }
1210 0 0 $domains_verified ? :
1214 0 0 $domains_verified ? :
1227 0 0 unless $self->{'csr'}
1232 0 0 unless ($self->{'finalize'})
1234 0 0 $status == 403 ? :
0 0 unless $status == 201
1235 0 0 if (ref $content eq 'HASH' and $content->{'identifiers'} and $content->{'authorizations'})
1240 0 0 if ($self->{'finalize'})
1247 0 0 if $self->{'try'} and ++$try == $self->{'try'}
1249 0 0 if ($status == 200 and $content and $content->{'status'}) { }
1250 0 0 if ($content->{'status'} eq 'valid') { }
0 0 elsif ($content->{'status'} eq 'invalid') { }
0 0 elsif ($content->{'status'} eq 'pending') { }
1251 0 0 if ($content->{'certificate'}) { }
1254 0 0 if $self->version > 1
1256 0 0 unless $status == 200
1259 0 0 if ($content =~ /(\n\-+END CERTIFICATE\-+)[\s\r\n]+(.+)/s)
1279 0 0 unless $ready
1283 0 0 $self->{'links'} && $self->{'links'}{'up'} ? :
1284 0 0 $self->{'issuer_url'} ? :
1297 0 0 unless $self->{'alternatives'}
1303 0 0 if $self->version > 1
1305 0 0 unless $status == 200
1307 0 0 if ($content =~ /(\n\-+END CERTIFICATE\-+)[\s\r\n]+(.+)/s) { }
1327 0 0 if $self->issuer
1328 0 0 unless $self->{'issuer_url'}
1330 0 0 if ($status == 200)
1349 0 0 unless $crt
1353 0 0 if ($status == 200) { }
0 0 elsif ($status == 409) { }
1378 0 0 $self->{'links'} && $self->{'links'}{'terms-of-service'} ? :
1449 0 0 if ($self->{'alternative_certificates'} and defined $idx and $idx < @{$self->{'alternative_certificates'};})
1463 0 0 if ($self->{'alternative_certificates'})
1520 0 2 unless $self->{'failed_domains'} and @{$self->{'failed_domains'};}
1521 1 1 unless $all
1524 1 1 if ($proc)
1529 1 0 @rv ? :
1540 0 1 unless $self->{'domains'} and %{$self->{'domains'};}
1542 1 0 @list ? :
1560 0 2 if $params and ref $params eq 'HASH'
1561 0 2 if (not $res or $timeout and !($timeout =~ /^\d+/) || $timeout < 1) { }
2 0 elsif (ref $res or not $res =~ m[^\w+://]i) { }
1566 2 0 if (ref $res) { }
1568 0 2 unless $bio and &Net::SSLeay::BIO_write($bio, $$res)
1571 0 0 unless $bio
1573 0 2 if ($load_error) { }
1576 1 1 unless ($cert)
1594 0 0 unless $response->{'success'}
1607 0 3 unless $pem
1608 3 0 if $pem =~ /(?:^|\s+)-+BEGIN[^-]*-+\s+(.*?)\s+-+END/s
1621 3 0 $der && $type ? :
1636 1 0 unless $pkcs12_available
1637 0 0 unless $pass
1642 0 0 if $@ and $@ =~ /Usage/
1643 0 0 if $@
1665 0 1 if ($self->{'error'})
1667 0 0 ref $self->{'error'} ? :
0 0 $err ? :
1680 0 10 unless $type =~ /^\d+$/ and $type <= 1
1681 8 2 if ($type == 0) { }
2 0 elsif ($type == 1) { }
1683 2 6 if $attr < 2048 or $attr % 1024
1685 1 1 unless $attr and $attr ne 'default'
1686 0 2 unless defined &Net::SSLeay::EC_KEY_generate_key
1688 4 4 if ($key) { }
1690 0 4 unless $bio
1691 0 4 unless &Net::SSLeay::BIO_write($bio, $key)
1694 0 4 unless $pk
1697 0 4 unless $pk
1700 2 2 $type == 0 ? :
1702 1 3 if $@
1703 1 0 $@ ? :
1 3 unless $gen
1704 2 1 $type == 0 ? :
1712 0 6 unless $domains and !$ref || $ref eq 'ARRAY'
1713 0 6 if $attrib and ref $attrib ne 'HASH'
1715 0 6 unless $req
1716 0 6 unless &Net::SSLeay::X509_REQ_set_pubkey($req, $pk)
1717 6 0 $ref ? :
1718 6 0 unless $attrib and $attrib->{'CN'} || $attrib->{'commonName'}
1720 0 6 unless &Net::SSLeay::P_X509_REQ_add_extensions($req, &Net::SSLeay::NID_subject_alt_name, $list)
1722 0 6 unless $n
1725 0 30 unless &Net::SSLeay::X509_NAME_add_entry_by_txt($n, $key, scalar MBSTRING_UTF8(), scalar &encode_utf8($attrib->{$key}))
1727 0 6 unless &Net::SSLeay::X509_REQ_set_subject_name($req, $n)
1730 6 0 unless (&Net::SSLeay::X509_REQ_get_version($req))
1731 0 6 unless &Net::SSLeay::X509_REQ_set_version($req, 0)
1734 0 6 unless $md and &Net::SSLeay::X509_REQ_sign($req, $pk, $md)
1742 6 16 if $data{'r'}
1743 14 8 if $data{'b'}
1744 8 14 if $data{'k'}
1745 1 21 wantarray ? :
1752 0 6 if length($val) % 2
1763 0 1 unless ($url)
1765 0 0 wantarray ? :
1772 0 1 if (defined $payload or $method eq 'post') { }
1774 0 0 defined $payload ? :
1778 1 0 $resp->{'headers'}{'content-type'} && $resp->{'headers'}{'content-type'} =~ m[^application/(?:problem\+)?json] ? :
1779 0 1 $slurp ? :
1780 1 0 if $resp->{'headers'}{'replay-nonce'}
1782 1 0 unless ($slurp)
1786 0 1 if ($@)
1790 0 1 $resp->{'headers'}{'link'} ? :
1791 0 1 $resp->{'headers'}{'location'} ? :
1792 1 0 wantarray ? :
1797 0 3 unless $self->{'key_params'}
1808 0 0 unless defined $obj
1809 0 0 ref $obj ? :
1812 0 0 if ($url and $self->version > 1)
1813 0 0 if ($self->{'directory'}{'reg'} and not $opts->{'jwk'})
1828 0 0 unless $links
1830 0 0 ref $links eq 'ARRAY' ? :
1831 0 0 unless $link and $link =~ /^<([^>]+)>;rel="([^"]+)"$/i
1832 0 0 if ($2 eq 'alternate') { }
1844 0 0 unless $content
1846 0 0 if (my $name = $compat->{$_})
1854 0 0 $self->version == 2 ? :
1859 0 0 if not $req or $self->version == 1 or not $req->{'resource'}
1860 0 0 unless my $res = delete $req->{'resource'}
1861 0 0 if ($res eq 'new-reg' or $res eq 'reg') { }
0 0 elsif ($res eq 'new-cert') { }
1873 0 0 unless $data and $data->{'domain'}
1883 56 0 unless $self->{'debug'}
1885 0 0 if (not ref $_) { }
0 0 elsif ($self->{'debug'} > 1) { }
1886 0 0 $self->{'logger'} ? :
1888 0 0 $self->{'logger'} ? :
1896 22 24 if ($code == 0) { }
1899 0 24 if (ref $data eq 'HASH' and $data->{'error'}) { }
1905 46 0 if $data
1912 0 0 if ($err and ref $err eq 'HASH')
1913 0 0 if $err->{'error'} and $err->{'error'}{'detail'}
1914 0 0 if $err->{'detail'}
1921 0 0 unless $self->{'loaded_domains'}
1931 0 18 unless $file
1932 4 14 unless (ref $file)
1934 4 0 if (defined $fh)
1942 14 0 ref $file eq 'SCALAR' ? :
1948 1 0 unless (defined $_[5] and $_[5])
1954 1 0 unless ($@)
1957 1 0 unless $$exp and $s > $$exp
1966 2 1 !$content || $content =~ /^\-+BEGIN/ ? :