Branch Coverage

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


line true false branch
114 31 32 unless $self->cache_type
307 1 17 unless defined $_[0]
310 1 16 unless UNIVERSAL::isa($_[0], 'HTTP::Request')
319 2 14 if $self->cache_control_request
325 0 11 do { $self->_non_safe($presented_request) } ? :
11 5 $self->cache ? :
333 0 0 if ($response->is_success or $response->is_redirect)
337 5 6 if (my $cache_resp = $self->_retrieve($presented_request)) { }
348 2 14 if $self->cache_control_response
363 1 13 unless (UNIVERSAL::isa($forwarded_resp, 'HTTP::Response'))
401 0 9 unless $self->_may_store_in_cache($rqst, $resp)
403 9 0 if (my $resp_key = $self->_store_response($resp))
428 9 0 unless $@
456 6 5 unless $meta_dict
472 2 3 if (scalar @okay_keys)
486 3 0 if (scalar @vldt_keys)
501 2 1 if $etag
502 2 1 if $last
517 0 3 if ($resp_forwarded->code == 304)
532 3 0 unless (&HTTP::Status::is_server_error(scalar $resp_forwarded->code))
544 0 0 if (&HTTP::Status::is_server_error(scalar $resp_forwarded->code))
570 2 0 if (my $resp = eval { do { $self->cache->get($resp_key) } })
587 0 0 unless $meta_dict
623 0 11 unless $method
665 1 28 unless ($method)
666 1 0 if $DEBUG
670 1 27 unless ($method->is_method_cachable)
671 1 0 if $DEBUG
685 1 26 unless ($message)
686 1 0 if $DEBUG
699 1 25 if (&any(sub { lc $_ eq 'no-store'; } , @rqst_directives))
700 1 0 if $DEBUG
704 1 24 if (&any(sub { lc $_ eq 'no-store'; } , @resp_directives))
705 1 0 if $DEBUG
716 6 18 if ($self->is_shared)
717 1 5 if (&any(sub { lc $_ eq 'private'; } , @resp_directives))
718 1 0 if $DEBUG
730 5 18 if ($self->is_shared)
731 4 1 if ($rqst->header('Authorization'))
732 1 3 if (&any(sub { lc $_ eq 'must-revalidate'; } , @resp_directives))
733 1 0 if $DEBUG
737 1 2 if (&any(sub { lc $_ eq 'public'; } , @resp_directives))
738 1 0 if $DEBUG
742 1 1 if (&any(sub { lc $_ =~ /^s-maxage=\d+$/; } , @resp_directives))
743 1 0 if $DEBUG
747 1 0 if $DEBUG
763 1 18 if ($expires_at)
764 1 0 if $DEBUG
773 2 16 if (&any(sub { lc $_ =~ /^max-age=\d+$/; } , @resp_directives))
774 1 1 if $DEBUG
783 1 15 if ($self->is_shared)
784 1 0 if (&any(sub { lc $_ =~ /^s-maxage=\d+$/; } , @resp_directives))
785 1 0 if $DEBUG
807 9 6 if (&HTTP::Status::is_cacheable_by_default($code))
808 1 8 if $DEBUG
817 1 5 if (&any(sub { lc $_ eq 'public'; } , @resp_directives))
818 1 0 if $DEBUG
826 5 0 if $DEBUG
867 1 22 unless (URI::eq($rqst_presented->uri, $rqst_associated->uri))
868 1 0 if $DEBUG
881 2 20 unless ($rqst_presented->method eq $rqst_associated->method)
882 2 0 if $DEBUG
898 5 15 if ($resp_stored->header('Vary'))
900 1 4 if (scalar $resp_stored->header('Vary') eq '*')
901 1 0 if $DEBUG
914 2 2 unless ($header_presented eq $header_associated)
915 2 0 if $DEBUG
940 1 16 if (&any(sub { lc $_ eq 'no-cache'; } , @rqst_directives))
941 1 0 if $DEBUG
946 1 0 if ($rqst_presented->header('Pragma') and scalar $rqst_presented->header('Pragma') =~ /no-cache/)
951 1 0 if $DEBUG
970 1 14 if (&any(sub { lc $_ eq 'no-cache'; } , @resp_directives))
971 1 0 if $DEBUG
984 4 10 if ($resp_stored->is_fresh('heuristic_expiry', undef))
985 2 2 if $DEBUG
1005 0 10 if (&any(sub { lc $_ eq 'must-revalidate'; } , @resp_directives))
1006 0 0 if $DEBUG
1015 0 10 if (&any(sub { lc $_ eq 'proxy-revalidate'; } , @resp_directives) and $self->is_shared)
1020 0 0 if $DEBUG
1037 0 10 if ($directive)
1039 0 0 unless (defined $max_stale)
1040 0 0 if $DEBUG
1046 0 0 if (abs $freshness < $max_stale)
1047 0 0 if $DEBUG
1058 7 3 if $DEBUG