Branch Coverage

blib/lib/HTTP/Caching.pm
Criterion Covered Total %
branch 117 170 68.8


line true false branch
115 31 32 unless $self->cache_type
267 1 17 unless defined $_[0]
270 1 16 unless UNIVERSAL::isa($_[0], 'HTTP::Request')
279 2 14 if $self->cache_control_request
285 5 11 if (not $self->cache) { }
0 11 elsif ($self->_non_safe($presented_request)) { }
293 0 0 if ($response->is_success or $response->is_redirect)
297 5 6 if (my $cache_resp = $self->_retrieve($presented_request)) { }
308 2 14 if $self->cache_control_request
323 1 13 unless (UNIVERSAL::isa($forwarded_resp, 'HTTP::Response'))
361 0 9 unless $self->_may_store_in_cache($rqst, $resp)
363 9 0 if (my $resp_key = $self->_store_response($resp))
388 9 0 unless $@
416 6 5 unless $meta_dict
432 2 3 if (scalar @okay_keys)
446 3 0 if (scalar @vldt_keys)
461 2 1 if $etag
462 2 1 if $last
477 0 3 if ($resp_forwarded->code == 304)
492 3 0 unless (&HTTP::Status::is_server_error(scalar $resp_forwarded->code))
504 0 0 if (&HTTP::Status::is_server_error(scalar $resp_forwarded->code))
530 2 0 if (my $resp = eval { do { $self->cache->get($resp_key) } })
547 0 0 unless $meta_dict
583 0 11 unless $method
625 1 28 unless ($method)
626 1 0 if $DEBUG
630 1 27 unless ($method->is_method_cachable)
631 1 0 if $DEBUG
645 1 26 unless ($message)
646 1 0 if $DEBUG
659 1 25 if (&any(sub { lc $_ eq 'no-store'; } , @rqst_directives))
660 1 0 if $DEBUG
664 1 24 if (&any(sub { lc $_ eq 'no-store'; } , @resp_directives))
665 1 0 if $DEBUG
676 6 18 if ($self->is_shared)
677 1 5 if (&any(sub { lc $_ eq 'private'; } , @resp_directives))
678 1 0 if $DEBUG
690 5 18 if ($self->is_shared)
691 4 1 if ($rqst->header('Authorization'))
692 1 3 if (&any(sub { lc $_ eq 'must-revalidate'; } , @resp_directives))
693 1 0 if $DEBUG
697 1 2 if (&any(sub { lc $_ eq 'public'; } , @resp_directives))
698 1 0 if $DEBUG
702 1 1 if (&any(sub { lc $_ =~ /^s-maxage=\d+$/; } , @resp_directives))
703 1 0 if $DEBUG
707 1 0 if $DEBUG
723 1 18 if ($expires_at)
724 1 0 if $DEBUG
733 2 16 if (&any(sub { lc $_ =~ /^max-age=\d+$/; } , @resp_directives))
734 1 1 if $DEBUG
743 1 15 if ($self->is_shared)
744 1 0 if (&any(sub { lc $_ =~ /^s-maxage=\d+$/; } , @resp_directives))
745 1 0 if $DEBUG
767 9 6 if (HTTP::Status::is_cacheable_by_default($code))
768 1 8 if $DEBUG
777 1 5 if (&any(sub { lc $_ eq 'public'; } , @resp_directives))
778 1 0 if $DEBUG
786 5 0 if $DEBUG
827 1 22 unless (URI::eq($rqst_presented->uri, $rqst_associated->uri))
828 1 0 if $DEBUG
841 2 20 unless ($rqst_presented->method eq $rqst_associated->method)
842 2 0 if $DEBUG
858 5 15 if ($resp_stored->header('Vary'))
860 1 4 if (scalar $resp_stored->header('Vary') eq '*')
861 1 0 if $DEBUG
874 2 2 unless ($header_presented eq $header_associated)
875 2 0 if $DEBUG
900 1 16 if (&any(sub { lc $_ eq 'no-cache'; } , @rqst_directives))
901 1 0 if $DEBUG
906 1 0 if ($rqst_presented->header('Pragma') and scalar $rqst_presented->header('Pragma') =~ /no-cache/)
911 1 0 if $DEBUG
930 1 14 if (&any(sub { lc $_ eq 'no-cache'; } , @resp_directives))
931 1 0 if $DEBUG
944 4 10 if ($resp_stored->is_fresh('heuristic_expiry', undef))
945 2 2 if $DEBUG
965 0 10 if (&any(sub { lc $_ eq 'must-revalidate'; } , @resp_directives))
966 0 0 if $DEBUG
975 0 10 if (&any(sub { lc $_ eq 'proxy-revalidate'; } , @resp_directives) and $self->is_shared)
980 0 0 if $DEBUG
997 0 10 if ($directive)
999 0 0 unless ($max_stale)
1000 0 0 if $DEBUG
1006 0 0 if (abs $freshness < $max_stale)
1007 0 0 if $DEBUG
1018 7 3 if $DEBUG