HTTP2/Frame/Rst_stream.pm

filter: Statementstmt 80.0% 24 / 30 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 76.1% 32 / 42 CC 3 SCAR 7.2
CC
3
Cov
76%
decode
3.8
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« HTTP2/Huffman.pm ↑ Summary HTTP2/Constants.pm »
1 package Protocol::HTTP2::Frame::Rst_stream;
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(const_name :flags :errors);
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 5 ▶sub decode {
Subroutine decode: called CC=3 SCAR=13.3
Pod undocumented
8 5 my ( $con, $buf_ref, $buf_offset, $length ) = @_;
9 5 my $frame_ref = $con->decode_context->{frame};
10  
11 # RST_STREAM associated with stream
12 5 ▶ if ( $frame_ref->{stream} == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($frame_ref->{"stream"} == 0) 0 5 5
13 0 tracer->error("Received reset stream with stream id 0");
14 0 $con->error(PROTOCOL_ERROR);
15 0 return undef;
16 }
17  
18 5 ▶ if ( $length != 4 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length != 4) 0 5 5
19 0 tracer->error("Received reset stream with invalid length $length");
20 0 $con->error(FRAME_SIZE_ERROR);
21 0 return undef;
22 }
23  
24 5 my $code = unpack( 'N', substr( $$buf_ref, $buf_offset, 4 ) );
25  
26 5 tracer->debug( "Receive reset stream with error code "
27 . const_name( "errors", $code )
28 . "\n" );
29 5 $con->stream_reset( $frame_ref->{stream}, $code );
30  
31 5 return $length;
32 }
33  
34 5 ▶sub encode {
Subroutine encode: called CC=1 SCAR=0.0
Pod undocumented
35 5 my ( $con, $flags_ref, $stream, $data ) = @_;
36 5 $con->stream_reset( $stream, $data );
37 5 return pack 'N', $data;
38 }
39  
40 13 1;
« HTTP2/Huffman.pm ↑ Summary HTTP2/Constants.pm »