line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::HTTP2::Constants; |
2
|
11
|
|
|
11
|
|
70360
|
use strict; |
|
11
|
|
|
|
|
43
|
|
|
11
|
|
|
|
|
296
|
|
3
|
11
|
|
|
11
|
|
56
|
use warnings; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
1733
|
|
4
|
|
|
|
|
|
|
use constant { |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Header Compression |
7
|
11
|
|
|
|
|
8239
|
MAX_INT_SIZE => 4, |
8
|
|
|
|
|
|
|
MAX_PAYLOAD_SIZE => ( 1 << 23 ) - 1, |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Frame |
11
|
|
|
|
|
|
|
FRAME_HEADER_SIZE => 9, |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Flow control |
14
|
|
|
|
|
|
|
MAX_FCW_SIZE => ( 1 << 31 ) - 1, |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Settings defaults |
17
|
|
|
|
|
|
|
DEFAULT_HEADER_TABLE_SIZE => 4_096, |
18
|
|
|
|
|
|
|
DEFAULT_ENABLE_PUSH => 1, |
19
|
|
|
|
|
|
|
DEFAULT_MAX_CONCURRENT_STREAMS => 100, |
20
|
|
|
|
|
|
|
DEFAULT_INITIAL_WINDOW_SIZE => 65_535, |
21
|
|
|
|
|
|
|
DEFAULT_MAX_FRAME_SIZE => 16_384, |
22
|
|
|
|
|
|
|
DEFAULT_MAX_HEADER_LIST_SIZE => 65_536, |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Priority |
25
|
|
|
|
|
|
|
DEFAULT_WEIGHT => 16, |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Stream states |
28
|
|
|
|
|
|
|
IDLE => 1, |
29
|
|
|
|
|
|
|
RESERVED => 2, |
30
|
|
|
|
|
|
|
OPEN => 3, |
31
|
|
|
|
|
|
|
HALF_CLOSED => 4, |
32
|
|
|
|
|
|
|
CLOSED => 5, |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Endpoint types |
35
|
|
|
|
|
|
|
CLIENT => 1, |
36
|
|
|
|
|
|
|
SERVER => 2, |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Preface string |
39
|
|
|
|
|
|
|
PREFACE => "PRI * HTTP/2.0\x0d\x0a\x0d\x0aSM\x0d\x0a\x0d\x0a", |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Frame types |
42
|
|
|
|
|
|
|
DATA => 0, |
43
|
|
|
|
|
|
|
HEADERS => 1, |
44
|
|
|
|
|
|
|
PRIORITY => 2, |
45
|
|
|
|
|
|
|
RST_STREAM => 3, |
46
|
|
|
|
|
|
|
SETTINGS => 4, |
47
|
|
|
|
|
|
|
PUSH_PROMISE => 5, |
48
|
|
|
|
|
|
|
PING => 6, |
49
|
|
|
|
|
|
|
GOAWAY => 7, |
50
|
|
|
|
|
|
|
WINDOW_UPDATE => 8, |
51
|
|
|
|
|
|
|
CONTINUATION => 9, |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Flags |
54
|
|
|
|
|
|
|
ACK => 0x1, |
55
|
|
|
|
|
|
|
END_STREAM => 0x1, |
56
|
|
|
|
|
|
|
END_HEADERS => 0x4, |
57
|
|
|
|
|
|
|
PADDED => 0x8, |
58
|
|
|
|
|
|
|
PRIORITY_FLAG => 0x20, |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Errors |
61
|
|
|
|
|
|
|
NO_ERROR => 0, |
62
|
|
|
|
|
|
|
PROTOCOL_ERROR => 1, |
63
|
|
|
|
|
|
|
INTERNAL_ERROR => 2, |
64
|
|
|
|
|
|
|
FLOW_CONTROL_ERROR => 3, |
65
|
|
|
|
|
|
|
SETTINGS_TIMEOUT => 4, |
66
|
|
|
|
|
|
|
STREAM_CLOSED => 5, |
67
|
|
|
|
|
|
|
FRAME_SIZE_ERROR => 6, |
68
|
|
|
|
|
|
|
REFUSED_STREAM => 7, |
69
|
|
|
|
|
|
|
CANCEL => 8, |
70
|
|
|
|
|
|
|
COMPRESSION_ERROR => 9, |
71
|
|
|
|
|
|
|
CONNECT_ERROR => 10, |
72
|
|
|
|
|
|
|
ENHANCE_YOUR_CALM => 11, |
73
|
|
|
|
|
|
|
INADEQUATE_SECURITY => 12, |
74
|
|
|
|
|
|
|
HTTP_1_1_REQUIRED => 13, |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# SETTINGS |
77
|
|
|
|
|
|
|
SETTINGS_HEADER_TABLE_SIZE => 1, |
78
|
|
|
|
|
|
|
SETTINGS_ENABLE_PUSH => 2, |
79
|
|
|
|
|
|
|
SETTINGS_MAX_CONCURRENT_STREAMS => 3, |
80
|
|
|
|
|
|
|
SETTINGS_INITIAL_WINDOW_SIZE => 4, |
81
|
|
|
|
|
|
|
SETTINGS_MAX_FRAME_SIZE => 5, |
82
|
|
|
|
|
|
|
SETTINGS_MAX_HEADER_LIST_SIZE => 6, |
83
|
|
|
|
|
|
|
|
84
|
11
|
|
|
11
|
|
61
|
}; |
|
11
|
|
|
|
|
19
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
require Exporter; |
87
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
88
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
89
|
|
|
|
|
|
|
frame_types => [ |
90
|
|
|
|
|
|
|
qw(DATA HEADERS PRIORITY RST_STREAM SETTINGS PUSH_PROMISE |
91
|
|
|
|
|
|
|
PING GOAWAY WINDOW_UPDATE CONTINUATION) |
92
|
|
|
|
|
|
|
], |
93
|
|
|
|
|
|
|
errors => [ |
94
|
|
|
|
|
|
|
qw(NO_ERROR PROTOCOL_ERROR INTERNAL_ERROR FLOW_CONTROL_ERROR |
95
|
|
|
|
|
|
|
SETTINGS_TIMEOUT STREAM_CLOSED FRAME_SIZE_ERROR REFUSED_STREAM CANCEL |
96
|
|
|
|
|
|
|
COMPRESSION_ERROR CONNECT_ERROR ENHANCE_YOUR_CALM INADEQUATE_SECURITY |
97
|
|
|
|
|
|
|
HTTP_1_1_REQUIRED |
98
|
|
|
|
|
|
|
) |
99
|
|
|
|
|
|
|
], |
100
|
|
|
|
|
|
|
preface => [qw(PREFACE)], |
101
|
|
|
|
|
|
|
flags => [qw(ACK END_STREAM END_HEADERS PADDED PRIORITY_FLAG)], |
102
|
|
|
|
|
|
|
settings => [ |
103
|
|
|
|
|
|
|
qw(SETTINGS_HEADER_TABLE_SIZE SETTINGS_ENABLE_PUSH |
104
|
|
|
|
|
|
|
SETTINGS_MAX_CONCURRENT_STREAMS SETTINGS_INITIAL_WINDOW_SIZE |
105
|
|
|
|
|
|
|
SETTINGS_MAX_FRAME_SIZE SETTINGS_MAX_HEADER_LIST_SIZE) |
106
|
|
|
|
|
|
|
], |
107
|
|
|
|
|
|
|
limits => [ |
108
|
|
|
|
|
|
|
qw(MAX_INT_SIZE MAX_PAYLOAD_SIZE MAX_FCW_SIZE DEFAULT_WEIGHT |
109
|
|
|
|
|
|
|
DEFAULT_HEADER_TABLE_SIZE |
110
|
|
|
|
|
|
|
DEFAULT_MAX_CONCURRENT_STREAMS |
111
|
|
|
|
|
|
|
DEFAULT_ENABLE_PUSH |
112
|
|
|
|
|
|
|
DEFAULT_INITIAL_WINDOW_SIZE |
113
|
|
|
|
|
|
|
DEFAULT_MAX_FRAME_SIZE |
114
|
|
|
|
|
|
|
DEFAULT_MAX_HEADER_LIST_SIZE |
115
|
|
|
|
|
|
|
FRAME_HEADER_SIZE) |
116
|
|
|
|
|
|
|
], |
117
|
|
|
|
|
|
|
states => [qw(IDLE RESERVED OPEN HALF_CLOSED CLOSED)], |
118
|
|
|
|
|
|
|
endpoints => [qw(CLIENT SERVER)], |
119
|
|
|
|
|
|
|
); |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
my %reverse; |
122
|
|
|
|
|
|
|
{ |
123
|
11
|
|
|
11
|
|
64
|
no strict 'refs'; |
|
11
|
|
|
|
|
17
|
|
|
11
|
|
|
|
|
2150
|
|
124
|
|
|
|
|
|
|
for my $k ( keys %EXPORT_TAGS ) { |
125
|
|
|
|
|
|
|
for my $v ( @{ $EXPORT_TAGS{$k} } ) { |
126
|
|
|
|
|
|
|
$reverse{$k}{ &{$v} } = $v; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub const_name { |
132
|
241
|
|
|
241
|
0
|
47974
|
my ( $tag, $value ) = @_; |
133
|
241
|
50
|
50
|
|
|
97248
|
exists $reverse{$tag} ? ( $reverse{$tag}{$value} || '' ) : ''; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
our @EXPORT_OK = ( qw(const_name), map { @$_ } values %EXPORT_TAGS ); |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1; |