Branch Coverage

blib/lib/Net/Gemini.pm
Criterion Covered Total %
branch 68 96 70.8


line true false branch
31 0 108 if ($slash_path)
32 0 0 if $other == $self
76 19 126 unless (defined $source)
82 19 107 unless ($obj{'_uri'}->scheme eq "gemini")
89 19 88 if (length $yuri > 1024)
104 0 84 if ($depth != 0)
105 0 0 if $param{'tofu'}
120 1 87 $param{'tofu'} ? :
73 15 exists $param{'ssl'} ? :
0 69 unless $obj{'_socket'} = "IO::Socket::SSL"->new("SSL_hostname", $obj{'_host'}, $param{'tofu'} ? ("SSL_verifycn_scheme", "none") : (), "SSL_verify_callback", sub { my($ok, $ctx_store, $certname, $error, $cert, $depth) = @_; if ($depth != 0) { return 1 if $param{'tofu'}; return $ok; } ; ($param{'verify_ssl'} || \&Net::Gemini::_verify_ssl)->(@obj{"_host", "_port"}, &Net::SSLeay::X509_get_fingerprint($cert, "sha256"), &Net::SSLeay::P_ASN1_TIME_get_isotime(scalar &Net::SSLeay::X509_get_notBefore($cert)), &Net::SSLeay::P_ASN1_TIME_get_isotime(scalar &Net::SSLeay::X509_get_notAfter($cert)), $ok, $cert); } , exists $param{'ssl'} ? %{$param{"ssl"};} : (), "PeerHost", $obj{'_host'}, "PeerPort", $obj{'_port'})
122 19 69 unless (eval { do { die $! unless $obj{'_socket'} = "IO::Socket::SSL"->new("SSL_hostname", $obj{'_host'}, $param{'tofu'} ? ("SSL_verifycn_scheme", "none") : (), "SSL_verify_callback", sub { my($ok, $ctx_store, $certname, $error, $cert, $depth) = @_; if ($depth != 0) { return 1 if $param{'tofu'}; return $ok; } ; ($param{'verify_ssl'} || \&Net::Gemini::_verify_ssl)->(@obj{"_host", "_port"}, &Net::SSLeay::X509_get_fingerprint($cert, "sha256"), &Net::SSLeay::P_ASN1_TIME_get_isotime(scalar &Net::SSLeay::X509_get_notBefore($cert)), &Net::SSLeay::P_ASN1_TIME_get_isotime(scalar &Net::SSLeay::X509_get_notAfter($cert)), $ok, $cert); } , exists $param{'ssl'} ? %{$param{"ssl"};} : (), "PeerHost", $obj{'_host'}, "PeerPort", $obj{'_port'}); 1 } })
130 0 69 unless (defined $n)
139 0 69 if $param{'early_shutdown'}
145 0 145 unless (defined $n)
149 0 145 if ($n == 0)
154 69 76 if length $obj{'_buf'} >= 3
160 51 18 if ($obj{'_buf'} =~ /^(([1-6])[0-9])[ ]/) { }
175 33 18526 if ($obj{'_buf'} =~ /^(.{0,1024}?)\r\n/) { }
178 2 31 if ($len == 0) { }
180 2 0 if $obj{'_code'} == 2
185 0 31 unless (eval { do { $obj{'_meta'} = &Encode::decode("UTF-8", $obj{'_meta'}, 1); 1 } })
192 18 3 if ($obj{'_code'} == 2 and $obj{'_meta'} =~ m[^(?i)text/] and not $obj{'_meta'} =~ /(?i)charset=/)
202 18 18508 if ($len > 1024)
208 0 18508 unless (defined $n)
212 0 18508 if ($n == 0)
221 46 99 if defined $obj{'_socket'} and $obj{'_code'} != 2
230 6 1 unless exists $options{'max_redirects'}
232 6 1 unless exists $options{'redirect_delay'}
234 6 1 unless exists $options{'max_size'}
240 1 14 exists $options{'param'} ? :
241 5 10 if ($code == 2) { }
8 2 elsif ($code == 3 and ++$redirects <= $options{'max_redirects'}) { }
247 1 4 if (exists $options{'content_callback'}) { }
248 1 0 if ($len)
249 1 0 unless $options{'content_callback'}->($gem->{'_buf'}, $len, $gem)
254 0 0 if (not defined $len) { }
0 0 elsif ($len == 0) { }
259 0 0 unless $options{'content_callback'}->($buf, $len, $gem)
262 3 1 if ($len)
263 0 3 if ($len > $options{'max_size'})
274 0 7 if (not defined $len) { }
3 4 elsif ($len == 0) { }
279 1 3 if ($len > $options{'max_size'})
309 17 1 if ($len)
310 0 17 unless &$callback($self->{'_buf'}, $len)
318 0 18 if (not defined $len) { }
17 1 elsif ($len == 0) { }
323 1 0 unless &$callback($buf, $len)