HTTP2/Frame/Continuation.pm

filter: Statementstmt 84.6% 22 / 26 Branchbran 50.0% 4 / 8 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 69.3% 34 / 49 CC 6 SCAR 17.3
CC
6
Cov
72%
decode
9.5
BEGIN
1.0
BEGIN
1.0
CRAP 5.6
« HTTP2/Client.pm ↑ Summary HTTP2/Frame/Priority.pm »
1 package Protocol::HTTP2::Frame::Continuation;
2 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use Protocol::HTTP2::Constants qw(:flags :errors :settings);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use Protocol::HTTP2::Trace qw(tracer);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶sub decode {
Subroutine decode: called CC=6 SCAR=22.5
Pod undocumented
8 1 my ( $con, $buf_ref, $buf_offset, $length ) = @_;
9 1 my $frame_ref = $con->decode_context->{frame};
10  
11 # Protocol errors
12 1 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($frame_ref->{"stream"} == 0) 0 1 1
13 # CONTINUATION frames MUST be associated with a stream
14 $frame_ref->{stream} == 0
15 )
16 {
17 0 $con->error(PROTOCOL_ERROR);
18 0 return undef;
19 }
20 1 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (length($con->stream_header_block($frame_ref->{"stream"})) + $length > $con->dec_setting(6)) 0 1 1
21 # Headers compressed size already exceeded decompressed limit
22 length( $con->stream_header_block( $frame_ref->{stream} ) ) + $length >
23 $con->dec_setting(SETTINGS_MAX_HEADER_LIST_SIZE)
24 )
25 {
26 0 $con->error(ENHANCE_YOUR_CALM);
27 0 return undef;
28 }
29  
30 $con->stream_header_block_add( $frame_ref->{stream},
31 1 ▶ substr( $$buf_ref, $buf_offset, $length ) )
Branch: 1 branch
BranchTrueFalseTotal
$con->stream_header_block_add($frame_ref->{"stream"}, substr($$buf_ref, $buf_offset, $length)) or return undef 1 0 1
32 or return undef;
33  
34 # Stream header block complete
35 $con->stream_headers_done( $frame_ref->{stream} )
36 or return undef
37 1 ▶ if $frame_ref->{flags} & END_HEADERS;
Branch: 1 branch
BranchTrueFalseTotal
if $frame_ref->{"flags"} & 4 1 0 1
Condition40%2/5
$frame_ref->{'flags'} & 4 && ($con->stream_headers_done($frame_ref->{'stream'}) || (return undef))
!ll&&!rl&&r
010
$con->stream_headers_done($frame_ref->{"stream"}) or return undef
l!l
10
MC/DC0%0/2
$frame_ref->{'flags'} & 4 && ($con->stream_headers_done($frame_ref->{'stream'}) || (return undef))
$frame_ref->{'flags'} & 4 $con->stream_headers_done($frame_ref->{"stream"})
Truth table0%0/3
A && B
A= $frame_ref->{'flags'} & 4B= $con->stream_headers_done($frame_ref->{"stream"})
ABresult
0X0
100
111
38  
39 1 return $length;
40  
41 }
42  
43 3 ▶sub encode {
Subroutine encode: called CC=1 SCAR=0.0
Pod undocumented
44 3 my ( $con, $flags_ref, $stream, $data_ref ) = @_;
45 3 return $$data_ref;
46 }
47  
48 13 1;
« HTTP2/Client.pm ↑ Summary HTTP2/Frame/Priority.pm »