line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::HTTP2::Frame::Priority; |
2
|
11
|
|
|
11
|
|
51
|
use strict; |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
274
|
|
3
|
11
|
|
|
11
|
|
53
|
use warnings; |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
293
|
|
4
|
11
|
|
|
11
|
|
53
|
use Protocol::HTTP2::Constants qw(:flags :errors); |
|
11
|
|
|
|
|
17
|
|
|
11
|
|
|
|
|
2240
|
|
5
|
11
|
|
|
11
|
|
62
|
use Protocol::HTTP2::Trace qw(tracer); |
|
11
|
|
|
|
|
16
|
|
|
11
|
|
|
|
|
2847
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub decode { |
8
|
1
|
|
|
1
|
0
|
2
|
my ( $con, $buf_ref, $buf_offset, $length ) = @_; |
9
|
1
|
|
|
|
|
4
|
my $frame_ref = $con->decode_context->{frame}; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Priority frames MUST be associated with a stream |
12
|
1
|
50
|
|
|
|
6
|
if ( $frame_ref->{stream} == 0 ) { |
13
|
0
|
|
|
|
|
0
|
$con->error(PROTOCOL_ERROR); |
14
|
0
|
|
|
|
|
0
|
return undef; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
1
|
50
|
|
|
|
4
|
if ( $length != 5 ) { |
18
|
0
|
|
|
|
|
0
|
$con->error(FRAME_SIZE_ERROR); |
19
|
0
|
|
|
|
|
0
|
return undef; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
4
|
my ( $stream_dep, $weight ) = |
23
|
|
|
|
|
|
|
unpack( 'NC', substr( $$buf_ref, $buf_offset, 5 ) ); |
24
|
1
|
|
|
|
|
2
|
my $exclusive = $stream_dep >> 31; |
25
|
1
|
|
|
|
|
2
|
$stream_dep &= 0x7FFF_FFFF; |
26
|
1
|
|
|
|
|
1
|
$weight++; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
8
|
$con->stream_weight( $frame_ref->{stream}, $weight ); |
29
|
1
|
|
|
|
|
8
|
$con->stream_reprio( $frame_ref->{stream}, $exclusive, $stream_dep ); |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
4
|
return $length; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub encode { |
35
|
1
|
|
|
1
|
0
|
3
|
my ( $con, $flags_ref, $stream, $data_ref ) = @_; |
36
|
1
|
|
|
|
|
3
|
my $stream_dep = $data_ref->[0]; |
37
|
1
|
|
|
|
|
3
|
my $weight = $data_ref->[1] - 1; |
38
|
1
|
|
|
|
|
9
|
pack( 'NC', $stream_dep, $weight ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |