Branch Coverage

blib/lib/Net/Gemini.pm
Criterion Covered Total %
branch 72 98 73.4


line true false branch
31 1 121 if ($slash_path)
32 1 0 if $other == $self
85 19 137 unless (defined $source)
91 19 118 unless ($obj{'_uri'}->scheme eq "gemini")
98 19 99 if (length $yuri > 1024)
112 0 99 exists $param{'family'} ? :
19 80 unless $obj{'_socket'} = "IO::Socket::IP"->new(exists $param{'family'} ? ("Domain", $param{'family'}) : (), "PeerAddr", $obj{'_host'}, "PeerPort", $obj{'_port'}, "Proto", "tcp")
121 0 96 if ($depth != 0)
122 0 0 if $param{'tofu'}
143 8 72 $param{'tofu'} ? :
65 15 exists $param{'ssl'} ? :
0 79 unless "IO::Socket::SSL"->start_SSL($obj{'_socket'}, "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; } ; my $digest = ($param{'verify_ssl'} || \&Net::Gemini::_verify_ssl)->({"host", $obj{'_host'}, "port", $obj{'_port'}, "cert", $cert, "digest", uc &sha256_hex(&Net::SSLeay::X509_get_X509_PUBKEY($cert)), "ip", $obj{'_ip'}, "notBefore", &Net::SSLeay::P_ASN1_TIME_get_isotime(scalar &Net::SSLeay::X509_get_notBefore($cert)), "notAfter", &Net::SSLeay::P_ASN1_TIME_get_isotime(scalar &Net::SSLeay::X509_get_notAfter($cert)), "okay", $ok}); } , exists $param{'ssl'} ? %{$param{"ssl"};} : ())
146 19 79 unless (eval { do { die $! unless $obj{'_socket'} = "IO::Socket::IP"->new(exists $param{'family'} ? ("Domain", $param{'family'}) : (), "PeerAddr", $obj{'_host'}, "PeerPort", $obj{'_port'}, "Proto", "tcp"); $obj{'_ip'} = $obj{'_socket'}->peerhost; die $! unless "IO::Socket::SSL"->start_SSL($obj{'_socket'}, "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; } ; my $digest = ($param{'verify_ssl'} || \&Net::Gemini::_verify_ssl)->({"host", $obj{'_host'}, "port", $obj{'_port'}, "cert", $cert, "digest", uc &sha256_hex(&Net::SSLeay::X509_get_X509_PUBKEY($cert)), "ip", $obj{'_ip'}, "notBefore", &Net::SSLeay::P_ASN1_TIME_get_isotime(scalar &Net::SSLeay::X509_get_notBefore($cert)), "notAfter", &Net::SSLeay::P_ASN1_TIME_get_isotime(scalar &Net::SSLeay::X509_get_notAfter($cert)), "okay", $ok}); } , exists $param{'ssl'} ? %{$param{"ssl"};} : ()); 1 } })
154 0 79 unless (defined $n)
164 0 155 unless (defined $n)
168 0 155 if ($n == 0)
173 79 76 if length $obj{'_buf'} >= 3
179 61 18 if ($obj{'_buf'} =~ /^(([1-6])[0-9])[ ]/) { }
198 43 18526 if ($obj{'_buf'} =~ /^(.{0,1024}?)\r\n/) { }
201 7 36 if ($len == 0) { }
203 7 0 if $obj{'_code'} == 2
209 0 36 unless (eval { do { $obj{'_meta'} = &Encode::decode("UTF-8", $obj{'_meta'}, 1); 1 } })
216 19 5 if ($obj{'_code'} == 2 and $obj{'_meta'} =~ m[^(?i)text/] and not $obj{'_meta'} =~ /(?i)charset=/)
226 18 18508 if ($len > 1024)
232 0 18508 unless (defined $n)
236 0 18508 if ($n == 0)
245 48 107 if defined $obj{'_socket'} and $obj{'_code'} != 2
254 6 1 unless exists $options{'max_redirects'}
256 6 1 unless exists $options{'redirect_delay'}
258 6 1 unless exists $options{'max_size'}
264 1 14 exists $options{'param'} ? :
265 5 10 if ($code == 2) { }
8 2 elsif ($code == 3 and ++$redirects <= $options{'max_redirects'}) { }
271 1 4 if (exists $options{'content_callback'}) { }
272 1 0 if ($len)
273 1 0 unless $options{'content_callback'}->($gem->{'_buf'}, $len, $gem)
279 0 0 if (not defined $len) { }
0 0 elsif ($len == 0) { }
284 0 0 unless $options{'content_callback'}->($buf, $len, $gem)
287 3 1 if ($len)
288 0 3 if ($len > $options{'max_size'})
299 0 7 if (not defined $len) { }
3 4 elsif ($len == 0) { }
304 1 3 if ($len > $options{'max_size'})
334 25 1 if ($len)
335 0 25 unless &$callback($self->{'_buf'}, $len)
343 0 26 if (not defined $len) { }
25 1 elsif ($len == 0) { }
348 1 0 unless &$callback($buf, $len)