HTTP/FastPath.pm

filter: Statementstmt 100% 192 / 192 Branchbran 83.3% 100 / 120 Conditioncond 60.5% 43 / 71 MC/DCmcdc 37.8% 14 / 37 Subroutinesub 100% 45 / 45 Podpod 66.6% 4 / 6 totaltotal 84.5% 398 / 471 CC 85 SCAR 34.9
CC
85
Cov
87%
_validate_view
87.7
view
27.4
native_compatible
10.0
CRAP 32.7
↑ Summary HTTP/Auth/Digest.pm »
1 package Uniform::HTTP::FastPath;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Uniform::HTTP::Message ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Uniform::HTTP::Request ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Uniform::HTTP::Response ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 our $VERSION = '0.06';
12  
13 3 ▶use constant ABI_VERSION => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 # The native header is compiled by consumers, never by this distribution.
16 3 ▶use constant NATIVE_ABI_VERSION => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶use constant _NATIVE_LAYOUT_VERSION => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 12 ▶sub native_compatible {
Subroutine native_compatible: called CC=10 SCAR=23.0
Pod undocumented
20 12 ▶ return 0 unless @_ == 2;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 3 9 12
21 9 my ($abi, $layout) = @_;
22 9 ▶ return 0 unless defined($abi) && !ref($abi) && $abi =~ /\A[0-9]+\z/
Branch: 1 branch
BranchTrueFalseTotal
unless defined $abi and not ref $abi and $abi =~ /\A[0-9]+\z/ and defined $layout and not ref $layout and $layout =~ /\A[0-9]+\z/ 6 3 9
Condition100%15/15
defined $abi and not ref $abi and $abi =~ /\A[0-9]+\z/ and defined $layout and not ref $layout and $layout =~ /\A[0-9]+\z/
!ll&&!rl&&r
513
defined $abi and not ref $abi and $abi =~ /\A[0-9]+\z/ and defined $layout and not ref $layout
!ll&&!rl&&r
414
defined $abi and not ref $abi and $abi =~ /\A[0-9]+\z/ and defined $layout
!ll&&!rl&&r
315
defined $abi and not ref $abi and $abi =~ /\A[0-9]+\z/
!ll&&!rl&&r
216
defined $abi and not ref $abi
!ll&&!rl&&r
117
MC/DC100%6/6
defined $abi and not ref $abi and $abi =~ /\A[0-9]+\z/ and defined $layout and not ref $layout and $layout =~ /\A[0-9]+\z/
defined $abi not ref $abi $abi =~ /\A[0-9]+\z/ defined $layout not ref $layout $layout =~ /\A[0-9]+\z/
Truth table100%7/7
A and not(B) and C and D and not(E) and F
A= defined $abiB= not ref $abiC= $abi =~ /\A[0-9]+\z/D= defined $layoutE= not ref $layoutF= $layout =~ /\A[0-9]+\z/
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
23 && defined($layout) && !ref($layout) && $layout =~ /\A[0-9]+\z/;
24 3 ▶ return $abi == NATIVE_ABI_VERSION && $layout == _NATIVE_LAYOUT_VERSION
Branch: 1 branch
BranchTrueFalseTotal
$abi == 1 && $layout == 1 ? : 1 2 3
Condition100%3/3
$abi == 1 and $layout == 1
!ll&&!rl&&r
111
MC/DC100%2/2
$abi == 1 and $layout == 1
$abi == 1 $layout == 1
Truth table100%3/3
A and B
A= $abi == 1B= $layout == 1
ABresult
0X0
100
111
25 ? 1 : 0;
26 }
27  
28 3 my $native_include_dir = do {
29 3 require File::Basename;
30 3 require File::Spec;
31 3 File::Spec->rel2abs(File::Spec->catdir(
32 File::Basename::dirname(__FILE__), 'FastPath',
33 ));
34 };
35  
36 2 ▶sub native_include_dir { return $native_include_dir }
Subroutine native_include_dir: called CC=1 SCAR=0.0
Pod undocumented
37  
38 3 ▶use constant KIND_MESSAGE => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 3 ▶use constant KIND_REQUEST => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 3 ▶use constant KIND_RESPONSE => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 3 ▶use constant FLAG_HAS_BUFFERED_BODY => 0x001;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 3 ▶use constant FLAG_COMPLETE => 0x002;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 3 ▶use constant FLAG_MUTABLE => 0x004;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 3 ▶use constant FLAG_INITIAL_MUTABLE => 0x008;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 3 ▶use constant FLAG_BODY_MUTABLE => 0x010;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 3 ▶use constant FLAG_TRAILERS_MUTABLE => 0x020;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 3 ▶use constant FLAG_HEADERS_LOSSLESS => 0x040;
Subroutine BEGIN: called CC=1 SCAR=0.0
49 3 ▶use constant FLAG_TRAILERS_LOSSLESS => 0x080;
Subroutine BEGIN: called CC=1 SCAR=0.0
50 3 ▶use constant FLAG_TARGET_EXACT => 0x100;
Subroutine BEGIN: called CC=1 SCAR=0.0
51  
52 3 ▶use constant SLOT_ABI => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 3 ▶use constant SLOT_KIND => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
54 3 ▶use constant SLOT_FLAGS => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
55 3 ▶use constant SLOT_VERSION => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 3 ▶use constant SLOT_METHOD => 4;
Subroutine BEGIN: called CC=1 SCAR=0.0
57 3 ▶use constant SLOT_TARGET => 5;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 3 ▶use constant SLOT_SCHEME => 6;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 3 ▶use constant SLOT_AUTHORITY => 7;
Subroutine BEGIN: called CC=1 SCAR=0.0
60 3 ▶use constant SLOT_PROTOCOL => 8;
Subroutine BEGIN: called CC=1 SCAR=0.0
61 3 ▶use constant SLOT_STATUS => 9;
Subroutine BEGIN: called CC=1 SCAR=0.0
62 3 ▶use constant SLOT_REASON => 10;
Subroutine BEGIN: called CC=1 SCAR=0.0
63 3 ▶use constant SLOT_HEADERS => 11;
Subroutine BEGIN: called CC=1 SCAR=0.0
64 3 ▶use constant SLOT_TRAILERS => 12;
Subroutine BEGIN: called CC=1 SCAR=0.0
65 3 ▶use constant SLOT_BODY => 13;
Subroutine BEGIN: called CC=1 SCAR=0.0
66 3 ▶use constant SLOT_COUNT => 14;
Subroutine BEGIN: called CC=1 SCAR=0.0
67  
68 3 ▶use constant _ALL_FLAGS => 0x1ff;
Subroutine BEGIN: called CC=1 SCAR=0.0
69  
70 8 ▶sub can_view {
Subroutine can_view: called CC=6 SCAR=18.0
Pod documented
71 8 ▶ croak 'can_view() requires exactly one message' unless @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 1 0 8 8
72 8 my ($message) = @_;
73 8 ▶ my $class = ref($message) || '';
Condition50%1/2
ref $message || ''
l!l
80
MC/DC0%0/1
ref $message || ''
ref $message
Truth table50%1/2
A
A= ref $message
Aresult
11
00
74 8 ▶ return 1 if $class eq 'Uniform::HTTP::Message';
Branch: 1 branch
BranchTrueFalseTotal
if $class eq "Uniform::HTTP::Message" 2 6 8
75 6 ▶ return 1 if $class eq 'Uniform::HTTP::Request';
Branch: 1 branch
BranchTrueFalseTotal
if $class eq "Uniform::HTTP::Request" 3 3 6
76 3 ▶ return 1 if $class eq 'Uniform::HTTP::Response';
Branch: 1 branch
BranchTrueFalseTotal
if $class eq "Uniform::HTTP::Response" 1 2 3
77 2 return 0;
78 }
79  
80 6 ▶sub view {
Subroutine view: called CC=27 SCAR=33.1
Pod documented
81 6 ▶ croak 'view() requires a message and optional ABI version'
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 1 or @_ == 2 0 6 6
Condition66%2/3
@_ == 1 or @_ == 2
l!l&&r!l&&!r
510
MC/DC0%0/2
@_ == 1 or @_ == 2
@_ == 1 @_ == 2
Truth table66%2/3
A or B
A= @_ == 1B= @_ == 2
ABresult
1X1
011
000
82 unless @_ == 1 || @_ == 2;
83 6 my ($message, $abi) = @_;
84 6 ▶ $abi = ABI_VERSION unless defined $abi;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $abi 5 1 6
85  
86 6 ▶ croak 'unsupported Uniform::HTTP fast-path ABI'
Branch: 1 branch
BranchTrueFalseTotal
unless not ref $abi and $abi =~ /\A[0-9]+\z/ and $abi == 1 1 5 6
Condition50%3/6
not ref $abi and $abi =~ /\A[0-9]+\z/ and $abi == 1
!ll&&!rl&&r
015
not ref $abi and $abi =~ /\A[0-9]+\z/
!ll&&!rl&&r
006
MC/DC33%1/3
not ref $abi and $abi =~ /\A[0-9]+\z/ and $abi == 1
not ref $abi $abi =~ /\A[0-9]+\z/ $abi == 1
Truth table50%2/4
not(A) and B and C
A= not ref $abiB= $abi =~ /\A[0-9]+\z/C= $abi == 1
ABCresult
0XX0
10X0
1100
1111
87 unless !ref($abi) && $abi =~ /\A[0-9]+\z/ && $abi == ABI_VERSION;
88 5 ▶ croak 'fast path requires an exact canonical Uniform::HTTP message class'
Branch: 1 branch
BranchTrueFalseTotal
unless can_view($message) 1 4 5
89 unless can_view($message);
90  
91 4 my $class = ref $message;
92 4 ▶ my $kind = $class eq 'Uniform::HTTP::Request' ? KIND_REQUEST
Branch: 2 branches
BranchTrueFalseTotal
$class eq 'Uniform::HTTP::Request' ? : 2 2 4
$class eq 'Uniform::HTTP::Response' ? : 1 1 2
93 : $class eq 'Uniform::HTTP::Response' ? KIND_RESPONSE
94 : KIND_MESSAGE;
95  
96 4 my $flags = FLAG_HEADERS_LOSSLESS | FLAG_TRAILERS_LOSSLESS;
97 4 ▶ $flags |= FLAG_HAS_BUFFERED_BODY if $message->{has_buffered_body};
Branch: 1 branch
BranchTrueFalseTotal
if $message->{"has_buffered_body"} 2 2 4
98 4 ▶ $flags |= FLAG_COMPLETE if $message->{complete};
Branch: 1 branch
BranchTrueFalseTotal
if $message->{"complete"} 2 2 4
99 4 ▶ $flags |= FLAG_MUTABLE if $message->{mutable};
Branch: 1 branch
BranchTrueFalseTotal
if $message->{"mutable"} 3 1 4
100 $flags |= FLAG_INITIAL_MUTABLE
101 4 ▶ if $message->{mutable} && !$message->{initial_frozen};
Branch: 1 branch
BranchTrueFalseTotal
if $message->{"mutable"} and not $message->{"initial_frozen"} 1 3 4
Condition100%3/3
$message->{"mutable"} and not $message->{"initial_frozen"}
!ll&&!rl&&r
121
MC/DC100%2/2
$message->{"mutable"} and not $message->{"initial_frozen"}
$message->{"mutable"} not $message->{"initial_frozen"}
Truth table100%3/3
A and not(B)
A= $message->{"mutable"}B= not $message->{"initial_frozen"}
ABresult
0X0
100
111
102 4 ▶ $flags |= FLAG_BODY_MUTABLE if $message->{mutable};
Branch: 1 branch
BranchTrueFalseTotal
if $message->{"mutable"} 3 1 4
103 $flags |= FLAG_TRAILERS_MUTABLE
104 4 ▶ if $message->{mutable} && !$message->{trailers_frozen};
Branch: 1 branch
BranchTrueFalseTotal
if $message->{"mutable"} and not $message->{"trailers_frozen"} 3 1 4
Condition66%2/3
$message->{"mutable"} and not $message->{"trailers_frozen"}
!ll&&!rl&&r
103
MC/DC50%1/2
$message->{"mutable"} and not $message->{"trailers_frozen"}
$message->{"mutable"} not $message->{"trailers_frozen"}
Truth table66%2/3
A and not(B)
A= $message->{"mutable"}B= not $message->{"trailers_frozen"}
ABresult
0X0
100
111
105 4 ▶ $flags |= FLAG_TARGET_EXACT if $kind == KIND_REQUEST;
Branch: 1 branch
BranchTrueFalseTotal
if $kind == 1 2 2 4
106  
107 return [
108 ABI_VERSION,
109 $kind,
110 $flags,
111 $message->{version},
112 $kind == KIND_REQUEST ? $message->{method} : undef,
113 $kind == KIND_REQUEST ? $message->{target} : undef,
114 $kind == KIND_REQUEST ? $message->{scheme} : undef,
115 $kind == KIND_REQUEST ? $message->{authority} : undef,
116 $kind == KIND_REQUEST ? $message->{protocol} : undef,
117 $kind == KIND_RESPONSE ? $message->{status} : undef,
118 $kind == KIND_RESPONSE ? $message->{reason} : undef,
119 $message->{headers},
120 $message->{trailers},
121 $message->{has_buffered_body} ? $message->{body} : undef,
122 4 ▶ ];
Branch: 8 branches
BranchTrueFalseTotal
$kind == 1 ? : 2 2 4
$kind == 1 ? : 2 2 4
$kind == 1 ? : 2 2 4
$kind == 1 ? : 2 2 4
$kind == 1 ? : 2 2 4
$kind == 2 ? : 1 3 4
$kind == 2 ? : 1 3 4
$message->{'has_buffered_body'} ? : 2 2 4
123 }
124  
125 5 ▶sub request_from_validated {
Subroutine request_from_validated: called CC=2 SCAR=6.9
Pod documented
126 5 ▶ croak 'request_from_validated() requires exactly one fast-path view'
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 1 0 5 5
127 unless @_ == 1;
128 5 my ($view) = @_;
129 5 _validate_view($view, KIND_REQUEST);
130  
131 1 my $self = _common_from_view($view);
132 1 $self->{method} = $view->[SLOT_METHOD];
133 1 $self->{target} = $view->[SLOT_TARGET];
134 1 $self->{scheme} = $view->[SLOT_SCHEME];
135 1 $self->{authority} = $view->[SLOT_AUTHORITY];
136 1 $self->{protocol} = $view->[SLOT_PROTOCOL];
137  
138 1 return bless $self, 'Uniform::HTTP::Request';
139 }
140  
141 1 ▶sub response_from_validated {
Subroutine response_from_validated: called CC=2 SCAR=7.0
Pod documented
142 1 ▶ croak 'response_from_validated() requires exactly one fast-path view'
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 1 0 1 1
143 unless @_ == 1;
144 1 my ($view) = @_;
145 1 _validate_view($view, KIND_RESPONSE);
146  
147 1 my $self = _common_from_view($view);
148 1 $self->{status} = $view->[SLOT_STATUS];
149 1 $self->{reason} = $view->[SLOT_REASON];
150  
151 1 return bless $self, 'Uniform::HTTP::Response';
152 }
153  
154 2 ▶sub _common_from_view {
Subroutine _common_from_view: called CC=7 SCAR=19.5
155 2 my ($view) = @_;
156 2 my $flags = $view->[SLOT_FLAGS];
157  
158 return {
159 2 ▶ version => $view->[SLOT_VERSION],
Branch: 6 branches
BranchTrueFalseTotal
$flags & 8 ? : 0 2 2
$flags & 32 ? : 1 1 2
$flags & 1 ? : 1 1 2
$flags & 1 ? : 1 1 2
$flags & 2 ? : 1 1 2
$flags & 4 ? : 1 1 2
160 headers => $view->[SLOT_HEADERS],
161 trailers => $view->[SLOT_TRAILERS],
162 initial_frozen => $flags & FLAG_INITIAL_MUTABLE ? 0 : 1,
163 trailers_frozen => $flags & FLAG_TRAILERS_MUTABLE ? 0 : 1,
164 body => $flags & FLAG_HAS_BUFFERED_BODY
165 ? $view->[SLOT_BODY] : undef,
166 has_buffered_body => $flags & FLAG_HAS_BUFFERED_BODY ? 1 : 0,
167 complete => $flags & FLAG_COMPLETE ? 1 : 0,
168 mutable => $flags & FLAG_MUTABLE ? 1 : 0,
169 };
170 }
171  
172 6 ▶sub _validate_view {
Subroutine _validate_view: called CC=37 SCAR=44.7
173 6 my ($view, $kind) = @_;
174  
175 6 ▶ croak 'fast-path view must be an array reference'
Branch: 1 branch
BranchTrueFalseTotal
unless ref $view eq "ARRAY" 0 6 6
176 unless ref($view) eq 'ARRAY';
177 6 ▶ croak 'fast-path view has the wrong number of slots'
Branch: 1 branch
BranchTrueFalseTotal
unless @$view == 14 0 6 6
178 unless @$view == SLOT_COUNT;
179 6 ▶ croak 'unsupported Uniform::HTTP fast-path ABI'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $view->[0] and not ref $view->[0] and $view->[0] =~ /\A[0-9]+\z/ and $view->[0] == 1 1 5 6
Condition44%4/9
defined $view->[0] and not ref $view->[0] and $view->[0] =~ /\A[0-9]+\z/ and $view->[0] == 1
!ll&&!rl&&r
015
defined $view->[0] and not ref $view->[0] and $view->[0] =~ /\A[0-9]+\z/
!ll&&!rl&&r
006
defined $view->[0] and not ref $view->[0]
!ll&&!rl&&r
006
MC/DC25%1/4
defined $view->[0] and not ref $view->[0] and $view->[0] =~ /\A[0-9]+\z/ and $view->[0] == 1
defined $view->[0] not ref $view->[0] $view->[0] =~ /\A[0-9]+\z/ $view->[0] == 1
Truth table40%2/5
A and not(B) and C and D
A= defined $view->[0]B= not ref $view->[0]C= $view->[0] =~ /\A[0-9]+\z/D= $view->[0] == 1
ABCDresult
0XXX0
10XX0
110X0
11100
11111
180 unless defined($view->[SLOT_ABI])
181 && !ref($view->[SLOT_ABI])
182 && $view->[SLOT_ABI] =~ /\A[0-9]+\z/
183 && $view->[SLOT_ABI] == ABI_VERSION;
184 5 ▶ croak 'fast-path view has the wrong message kind'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $view->[1] and not ref $view->[1] and $view->[1] =~ /\A[0-9]+\z/ and $view->[1] == $kind 1 4 5
Condition44%4/9
defined $view->[1] and not ref $view->[1] and $view->[1] =~ /\A[0-9]+\z/ and $view->[1] == $kind
!ll&&!rl&&r
014
defined $view->[1] and not ref $view->[1] and $view->[1] =~ /\A[0-9]+\z/
!ll&&!rl&&r
005
defined $view->[1] and not ref $view->[1]
!ll&&!rl&&r
005
MC/DC25%1/4
defined $view->[1] and not ref $view->[1] and $view->[1] =~ /\A[0-9]+\z/ and $view->[1] == $kind
defined $view->[1] not ref $view->[1] $view->[1] =~ /\A[0-9]+\z/ $view->[1] == $kind
Truth table40%2/5
A and not(B) and C and D
A= defined $view->[1]B= not ref $view->[1]C= $view->[1] =~ /\A[0-9]+\z/D= $view->[1] == $kind
ABCDresult
0XXX0
10XX0
110X0
11100
11111
185 unless defined($view->[SLOT_KIND])
186 && !ref($view->[SLOT_KIND])
187 && $view->[SLOT_KIND] =~ /\A[0-9]+\z/
188 && $view->[SLOT_KIND] == $kind;
189  
190 4 my $flags = $view->[SLOT_FLAGS];
191 4 ▶ croak 'fast-path flags must be a non-negative integer'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $flags and not ref $flags and $flags =~ /\A[0-9]+\z/ 0 4 4
Condition33%2/6
defined $flags and not ref $flags and $flags =~ /\A[0-9]+\z/
!ll&&!rl&&r
004
defined $flags and not ref $flags
!ll&&!rl&&r
004
MC/DC0%0/3
defined $flags and not ref $flags and $flags =~ /\A[0-9]+\z/
defined $flags not ref $flags $flags =~ /\A[0-9]+\z/
Truth table25%1/4
A and not(B) and C
A= defined $flagsB= not ref $flagsC= $flags =~ /\A[0-9]+\z/
ABCresult
0XX0
10X0
1100
1111
192 unless defined($flags) && !ref($flags) && $flags =~ /\A[0-9]+\z/;
193 4 ▶ croak 'fast-path view contains unknown flags'
Branch: 1 branch
BranchTrueFalseTotal
if $flags & '18446744073709551104' 0 4 4
194 if $flags & ~_ALL_FLAGS;
195  
196 4 ▶ croak 'fast-path headers must be an array reference'
Branch: 1 branch
BranchTrueFalseTotal
unless ref $view->[11] eq "ARRAY" 1 3 4
197 unless ref($view->[SLOT_HEADERS]) eq 'ARRAY';
198 3 ▶ croak 'fast-path trailers must be an array reference'
Branch: 1 branch
BranchTrueFalseTotal
unless ref $view->[12] eq "ARRAY" 0 3 3
199 unless ref($view->[SLOT_TRAILERS]) eq 'ARRAY';
200  
201 3 ▶ croak 'trusted canonical construction requires lossless headers'
Branch: 1 branch
BranchTrueFalseTotal
unless $flags & 64 0 3 3
202 unless $flags & FLAG_HEADERS_LOSSLESS;
203 3 ▶ croak 'trusted canonical construction requires lossless trailers'
Branch: 1 branch
BranchTrueFalseTotal
unless $flags & 128 0 3 3
204 unless $flags & FLAG_TRAILERS_LOSSLESS;
205  
206 3 ▶ if ($flags & FLAG_HAS_BUFFERED_BODY) {
Branch: 1 branch
BranchTrueFalseTotal
if ($flags & 1) { } 2 1 3
207 2 ▶ croak 'buffered fast-path body must be a defined plain scalar'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $view->[13] and not ref $view->[13] 0 2 2
Condition33%1/3
defined $view->[13] and not ref $view->[13]
!ll&&!rl&&r
002
MC/DC0%0/2
defined $view->[13] and not ref $view->[13]
defined $view->[13] not ref $view->[13]
Truth table33%1/3
A and not(B)
A= defined $view->[13]B= not ref $view->[13]
ABresult
0X0
100
111
208 unless defined($view->[SLOT_BODY]) && !ref($view->[SLOT_BODY]);
209 }
210 else {
211 1 ▶ croak 'fast-path body slot must be undef when no buffered body is present'
Branch: 1 branch
BranchTrueFalseTotal
if defined $view->[13] 0 1 1
212 if defined $view->[SLOT_BODY];
213 }
214  
215 3 ▶ my $mutable = $flags & FLAG_MUTABLE ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$flags & 4 ? : 2 1 3
216 3 ▶ my $body_mutable = $flags & FLAG_BODY_MUTABLE ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$flags & 16 ? : 2 1 3
217 3 ▶ croak 'fast-path body mutability is not canonical'
Branch: 1 branch
BranchTrueFalseTotal
unless $mutable == $body_mutable 0 3 3
218 unless $mutable == $body_mutable;
219 3 ▶ if (!$mutable) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($mutable) 1 2 3
220 1 ▶ croak 'immutable fast-path view advertises a mutable section'
Branch: 1 branch
BranchTrueFalseTotal
if $flags & 56 0 1 1
221 if $flags & (FLAG_INITIAL_MUTABLE
222 | FLAG_BODY_MUTABLE | FLAG_TRAILERS_MUTABLE);
223 }
224  
225 3 ▶ if ($kind == KIND_REQUEST) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind == 1) { } 2 1 3
226 2 ▶ croak 'trusted request requires exact target fidelity'
Branch: 1 branch
BranchTrueFalseTotal
unless $flags & 256 1 1 2
227 unless $flags & FLAG_TARGET_EXACT;
228 1 ▶ croak 'trusted request method must be a defined plain scalar'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $view->[4] and not ref $view->[4] 0 1 1
Condition33%1/3
defined $view->[4] and not ref $view->[4]
!ll&&!rl&&r
001
MC/DC0%0/2
defined $view->[4] and not ref $view->[4]
defined $view->[4] not ref $view->[4]
Truth table33%1/3
A and not(B)
A= defined $view->[4]B= not ref $view->[4]
ABresult
0X0
100
111
229 unless defined($view->[SLOT_METHOD]) && !ref($view->[SLOT_METHOD]);
230 1 ▶ croak 'trusted request target must be a defined plain scalar'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $view->[5] and not ref $view->[5] 0 1 1
Condition33%1/3
defined $view->[5] and not ref $view->[5]
!ll&&!rl&&r
001
MC/DC0%0/2
defined $view->[5] and not ref $view->[5]
defined $view->[5] not ref $view->[5]
Truth table33%1/3
A and not(B)
A= defined $view->[5]B= not ref $view->[5]
ABresult
0X0
100
111
231 unless defined($view->[SLOT_TARGET]) && !ref($view->[SLOT_TARGET]);
232 }
233 else {
234 1 ▶ croak 'response fast-path view must not set request target fidelity'
Branch: 1 branch
BranchTrueFalseTotal
if $flags & 256 0 1 1
235 if $flags & FLAG_TARGET_EXACT;
236 1 ▶ croak 'trusted response status must be a defined plain scalar'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $view->[9] and not ref $view->[9] 0 1 1
Condition33%1/3
defined $view->[9] and not ref $view->[9]
!ll&&!rl&&r
001
MC/DC0%0/2
defined $view->[9] and not ref $view->[9]
defined $view->[9] not ref $view->[9]
Truth table33%1/3
A and not(B)
A= defined $view->[9]B= not ref $view->[9]
ABresult
0X0
100
111
237 unless defined($view->[SLOT_STATUS]) && !ref($view->[SLOT_STATUS]);
238 }
239  
240 2 return;
241 }
242  
243 3 1;
244  
245 __END__
↑ Summary HTTP/Auth/Digest.pm »