Branch Coverage

blib/lib/Net/Gemini.pm
Criterion Covered Total %
branch 69 96 71.8


line true false branch
31 0 108 if ($slash_path)
32 0 0 if $other == $self
85 19 126 unless (defined $source)
91 19 107 unless ($obj{'_uri'}->scheme eq "gemini")
98 19 88 if (length $yuri > 1024)
111 19 69 unless $obj{'_socket'} = "IO::Socket::IP"->new("PeerAddr", $obj{'_host'}, "PeerPort", $obj{'_port'}, "Proto", "tcp")
120 0 84 if ($depth != 0)
121 0 0 if $param{'tofu'}
142 1 68 $param{'tofu'} ? :
54 15 exists $param{'ssl'} ? :
0 69 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"};} : ())
145 19 69 unless (eval { do { die $! unless $obj{'_socket'} = "IO::Socket::IP"->new("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 } })
153 0 69 unless (defined $n)
163 0 145 unless (defined $n)
167 0 145 if ($n == 0)
172 69 76 if length $obj{'_buf'} >= 3
178 51 18 if ($obj{'_buf'} =~ /^(([1-6])[0-9])[ ]/) { }
197 33 18526 if ($obj{'_buf'} =~ /^(.{0,1024}?)\r\n/) { }
200 2 31 if ($len == 0) { }
202 2 0 if $obj{'_code'} == 2
208 0 31 unless (eval { do { $obj{'_meta'} = &Encode::decode("UTF-8", $obj{'_meta'}, 1); 1 } })
215 18 3 if ($obj{'_code'} == 2 and $obj{'_meta'} =~ m[^(?i)text/] and not $obj{'_meta'} =~ /(?i)charset=/)
225 18 18508 if ($len > 1024)
231 0 18508 unless (defined $n)
235 0 18508 if ($n == 0)
244 46 99 if defined $obj{'_socket'} and $obj{'_code'} != 2
253 6 1 unless exists $options{'max_redirects'}
255 6 1 unless exists $options{'redirect_delay'}
257 6 1 unless exists $options{'max_size'}
263 1 14 exists $options{'param'} ? :
264 5 10 if ($code == 2) { }
8 2 elsif ($code == 3 and ++$redirects <= $options{'max_redirects'}) { }
270 1 4 if (exists $options{'content_callback'}) { }
271 1 0 if ($len)
272 1 0 unless $options{'content_callback'}->($gem->{'_buf'}, $len, $gem)
278 0 0 if (not defined $len) { }
0 0 elsif ($len == 0) { }
283 0 0 unless $options{'content_callback'}->($buf, $len, $gem)
286 3 1 if ($len)
287 0 3 if ($len > $options{'max_size'})
298 0 7 if (not defined $len) { }
3 4 elsif ($len == 0) { }
303 1 3 if ($len > $options{'max_size'})
333 17 1 if ($len)
334 0 17 unless &$callback($self->{'_buf'}, $len)
342 0 18 if (not defined $len) { }
17 1 elsif ($len == 0) { }
347 1 0 unless &$callback($buf, $len)