Branch Coverage

blib/lib/Mojolicious/Plugin/TrustedProxy.pm
Criterion Covered Total %
branch 41 50 82.0


line true false branch
24 0 8 unless ref $conf->{'ip_headers'} eq 'ARRAY'
28 0 8 unless ref $conf->{'scheme_headers'} eq 'ARRAY'
32 0 8 unless ref $conf->{'https_values'} eq 'ARRAY'
38 1 7 unless ref $conf->{'trusted_sources'} eq 'ARRAY'
46 3 13 unless @_
54 0 13 if (ref $trust eq 'ARRAY') { }
72 0 23 unless is_ip($ip) and $cidr and $cidr->isa('Net::CIDR::Lite')
73 0 23 if is_ipv4_mapped_ipv6($ip)
84 0 23 unless defined $conf
88 4 19 unless (defined $src_addr and $c->is_trusted_source($src_addr))
97 9 23 if (my $ip = $c->req->headers->header($header))
99 4 5 if (lc $header eq 'x-forwarded-for')
106 8 1 if is_ip($ip)
114 6 28 if (my $scheme = $c->req->headers->header($header))
116 4 2 if (not !$scheme and grep {$scheme eq lc $_;} @{$$conf{'https_values'};})
127 4 15 if (my $fwd = $c->req->headers->header('forwarded'))
128 4 0 if ($conf->{'parse_rfc7239'})
139 4 2 if ($param =~ /(for|by)=($ipv4_mask|$ipv6_mask)/i) { }
2 0 elsif ($param =~ /proto=(https?)/i) { }
140 2 2 if lc $1 eq 'for'
141 2 2 if lc $1 eq 'by'
146 2 2 if ($fwd_for and is_ip($fwd_for))
153 2 2 if ($fwd_by and is_ip($fwd_by))
159 2 2 if ($fwd_proto)
169 1 18 unless (not $conf->{'hide_headers'})