File Coverage

blib/lib/Protocol/HTTP2/Frame/Continuation.pm
Criterion Covered Total %
statement 14 22 63.6
branch 0 4 0.0
condition 0 2 0.0
subroutine 5 6 83.3
pod 0 2 0.0
total 19 36 52.7


line stmt bran cond sub pod time code
1             package Protocol::HTTP2::Frame::Continuation;
2 12     12   42 use strict;
  12         10  
  12         275  
3 12     12   39 use warnings;
  12         11  
  12         275  
4 12     12   48 use Protocol::HTTP2::Constants qw(:flags :errors);
  12         10  
  12         1804  
5 12     12   57 use Protocol::HTTP2::Trace qw(tracer);
  12         13  
  12         1802  
6              
7             sub decode {
8 0     0 0 0 my ( $con, $buf_ref, $buf_offset, $length ) = @_;
9 0         0 my $frame_ref = $con->decode_context->{frame};
10              
11             # Protocol errors
12 0 0       0 if (
13             # CONTINUATION frames MUST be associated with a stream
14             $frame_ref->{stream} == 0
15             )
16             {
17 0         0 $con->error(PROTOCOL_ERROR);
18 0         0 return undef;
19             }
20              
21             $con->stream_header_block( $frame_ref->{stream},
22 0         0 substr( $$buf_ref, $buf_offset, $length ) );
23              
24             # Stream header block complete
25             $con->stream_headers_done( $frame_ref->{stream} )
26             or return undef
27 0 0 0     0 if $frame_ref->{flags} & END_HEADERS;
28              
29 0         0 return $length;
30              
31             }
32              
33             sub encode {
34 2     2 0 2 my ( $con, $flags_ref, $stream, $data_ref ) = @_;
35 2         4 return $$data_ref;
36             }
37              
38             1;