http-2 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/lib/http/2/buffer.rb +6 -4
- data/lib/http/2/client.rb +5 -1
- data/lib/http/2/compressor.rb +42 -34
- data/lib/http/2/connection.rb +72 -86
- data/lib/http/2/emitter.rb +4 -1
- data/lib/http/2/error.rb +2 -0
- data/lib/http/2/flow_buffer.rb +8 -3
- data/lib/http/2/framer.rb +83 -94
- data/lib/http/2/huffman.rb +19 -17
- data/lib/http/2/server.rb +9 -7
- data/lib/http/2/stream.rb +48 -48
- data/lib/http/2/version.rb +3 -1
- data/lib/http/2.rb +2 -0
- metadata +7 -60
- data/.autotest +0 -20
- data/.coveralls.yml +0 -1
- data/.gitignore +0 -20
- data/.gitmodules +0 -3
- data/.rspec +0 -5
- data/.rubocop.yml +0 -93
- data/.rubocop_todo.yml +0 -131
- data/.travis.yml +0 -17
- data/Gemfile +0 -16
- data/Guardfile +0 -18
- data/Guardfile.h2spec +0 -12
- data/Rakefile +0 -49
- data/example/Gemfile +0 -3
- data/example/README.md +0 -44
- data/example/client.rb +0 -122
- data/example/helper.rb +0 -19
- data/example/keys/server.crt +0 -20
- data/example/keys/server.key +0 -27
- data/example/server.rb +0 -139
- data/example/upgrade_client.rb +0 -153
- data/example/upgrade_server.rb +0 -203
- data/http-2.gemspec +0 -22
- data/lib/tasks/generate_huffman_table.rb +0 -166
- data/spec/buffer_spec.rb +0 -28
- data/spec/client_spec.rb +0 -188
- data/spec/compressor_spec.rb +0 -666
- data/spec/connection_spec.rb +0 -681
- data/spec/emitter_spec.rb +0 -54
- data/spec/framer_spec.rb +0 -487
- data/spec/h2spec/h2spec.darwin +0 -0
- data/spec/h2spec/output/non_secure.txt +0 -317
- data/spec/helper.rb +0 -147
- data/spec/hpack_test_spec.rb +0 -84
- data/spec/huffman_spec.rb +0 -68
- data/spec/server_spec.rb +0 -52
- data/spec/stream_spec.rb +0 -878
- data/spec/support/deep_dup.rb +0 -55
- data/spec/support/duplicable.rb +0 -98
@@ -1,317 +0,0 @@
|
|
1
|
-
3.5. HTTP/2 Connection Preface
|
2
|
-
Sends invalid connection preface
|
3
|
✓ Sends invalid connection preface
|
4
|
-
|
5
|
-
4.2. Frame Size
|
6
|
-
Sends large size frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
7
1
|
✓ Sends large size frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
8
|
-
|
9
|
-
4.3. Header Compression and Decompression
|
10
|
-
Sends invalid header block fragment
|
11
2
|
✓ Sends invalid header block fragment
|
12
|
-
Sends Dynamic Table Size Update (RFC 7541, 6.3)
|
13
3
|
✓ Sends Dynamic Table Size Update (RFC 7541, 6.3)
|
14
|
-
Encodes Dynamic Table Size Update (RFC 7541, 6.3) after common header fields
|
15
4
|
× Encodes Dynamic Table Size Update (RFC 7541, 6.3) after common header fields
|
16
|
-
- The endpoint MUST terminate the connection with a connection error of type COMPRESSION_ERROR.
|
17
|
-
Expected: GOAWAY frame (ErrorCode: COMPRESSION_ERROR)
|
18
|
-
Connection close
|
19
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
20
|
-
|
21
|
-
5.1. Stream States
|
22
|
-
idle: Sends a DATA frame
|
23
5
|
✓ idle: Sends a DATA frame
|
24
|
-
idle: Sends a RST_STREAM frame
|
25
6
|
✓ idle: Sends a RST_STREAM frame
|
26
|
-
idle: Sends a WINDOW_UPDATE frame
|
27
7
|
✓ idle: Sends a WINDOW_UPDATE frame
|
28
|
-
idle: Sends a CONTINUATION frame
|
29
8
|
✓ idle: Sends a CONTINUATION frame
|
30
|
-
half closed (remote): Sends a DATA frame
|
31
9
|
× half closed (remote): Sends a DATA frame
|
32
|
-
- The endpoint MUST respond with a stream error (Section 5.4.2) of type STREAM_CLOSED.
|
33
|
-
Expected: GOAWAY frame (ErrorCode: STREAM_CLOSED)
|
34
|
-
RST_STREAM frame (ErrorCode: STREAM_CLOSED)
|
35
|
-
Connection close
|
36
|
-
Actual: WINDOW_UPDATE frame (Length: 4, Flags: 0)
|
37
|
-
half closed (remote): Sends a HEADERS frame
|
38
10
|
× half closed (remote): Sends a HEADERS frame
|
39
|
-
- The endpoint MUST respond with a stream error (Section 5.4.2) of type STREAM_CLOSED.
|
40
|
-
Expected: GOAWAY frame (ErrorCode: STREAM_CLOSED)
|
41
|
-
RST_STREAM frame (ErrorCode: STREAM_CLOSED)
|
42
|
-
Connection close
|
43
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
44
|
-
half closed (remote): Sends a CONTINUATION frame
|
45
11
|
× half closed (remote): Sends a CONTINUATION frame
|
46
|
-
- The endpoint MUST respond with a stream error (Section 5.4.2) of type STREAM_CLOSED.
|
47
|
-
Expected: GOAWAY frame (ErrorCode: STREAM_CLOSED)
|
48
|
-
RST_STREAM frame (ErrorCode: STREAM_CLOSED)
|
49
|
-
GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
50
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
51
|
-
Connection close
|
52
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
53
|
-
closed: Sends a CONTINUATION frame
|
54
12
|
× closed: Sends a CONTINUATION frame
|
55
|
-
- The endpoint MUST treat this as a stream error (Section 5.4.2) of type STREAM_CLOSED.
|
56
|
-
Expected: GOAWAY frame (ErrorCode: STREAM_CLOSED)
|
57
|
-
RST_STREAM frame (ErrorCode: STREAM_CLOSED)
|
58
|
-
GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
59
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
60
|
-
Connection close
|
61
|
-
Actual: Test timeout
|
62
|
-
|
63
|
-
5.1.1. Stream Identifiers
|
64
|
-
Sends even-numbered stream identifier
|
65
13
|
✓ Sends even-numbered stream identifier
|
66
|
-
|
67
|
-
5.1.2. Stream Concurrency
|
68
|
-
Sends HEADERS frames that causes their advertised concurrent stream limit to be exceeded
|
69
14
|
× Sends HEADERS frames that causes their advertised concurrent stream limit to be exceeded
|
70
|
-
- The endpoint MUST treat this as a stream error (Section 5.4.2) of type PROTOCOL_ERROR or REFUSED_STREAM
|
71
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
72
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
73
|
-
GOAWAY frame (ErrorCode: REFUSED_STREAM)
|
74
|
-
RST_STREAM frame (ErrorCode: REFUSED_STREAM)
|
75
|
-
Connection close
|
76
|
-
Actual: HEADERS frame (Length: 3, Flags: 4)
|
77
|
-
|
78
|
-
5.3. Stream Priority
|
79
|
-
5.3.1. Stream Dependencies
|
80
|
-
Sends HEADERS frame that depend on itself
|
81
15
|
× Sends HEADERS frame that depend on itself
|
82
|
-
- The endpoint MUST treat this as a stream error of type PROTOCOL_ERROR
|
83
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
84
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
85
|
-
Connection close
|
86
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
87
|
-
Sends PRIORITY frame that depend on itself
|
88
16
|
× Sends PRIORITY frame that depend on itself
|
89
|
-
- The endpoint MUST treat this as a stream error of type PROTOCOL_ERROR
|
90
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
91
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
92
|
-
Connection close
|
93
|
-
Actual: Test timeout
|
94
|
-
|
95
|
-
5.5. Extending HTTP/2
|
96
|
-
Sends an unknown extension frame
|
97
17
|
✓ Sends an unknown extension frame
|
98
|
-
Sends an unknown extension frame in the middle of a header block
|
99
18
|
× Sends an unknown extension frame in the middle of a header block
|
100
|
-
- The endpoint MUST treat as a connection error of type PROTOCOL_ERROR.
|
101
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
102
|
-
Connection close
|
103
|
-
Actual: Test timeout
|
104
|
-
|
105
|
-
6.1. DATA
|
106
|
-
Sends a DATA frame with 0x0 stream identifier
|
107
19
|
✓ Sends a DATA frame with 0x0 stream identifier
|
108
|
-
Sends a DATA frame on the stream that is not in "open" or "half-closed (local)" state
|
109
20
|
× Sends a DATA frame on the stream that is not in "open" or "half-closed (local)" state
|
110
|
-
- The endpoint MUST respond with a stream error (Section 5.4.2) of type STREAM_CLOSED.
|
111
|
-
Expected: GOAWAY frame (ErrorCode: STREAM_CLOSED)
|
112
|
-
RST_STREAM frame (ErrorCode: STREAM_CLOSED)
|
113
|
-
Connection close
|
114
|
-
Actual: WINDOW_UPDATE frame (Length: 4, Flags: 0)
|
115
|
-
Sends a DATA frame with invalid pad length
|
116
21
|
✓ Sends a DATA frame with invalid pad length
|
117
|
-
|
118
|
-
6.2. HEADERS
|
119
|
-
Sends a HEADERS frame followed by any frame other than CONTINUATION
|
120
22
|
✓ Sends a HEADERS frame followed by any frame other than CONTINUATION
|
121
|
-
Sends a HEADERS frame followed by a frame on a different stream
|
122
23
|
× Sends a HEADERS frame followed by a frame on a different stream
|
123
|
-
- The endpoint MUST treat the receipt of a frame on a different stream as a connection error of type PROTOCOL_ERROR.
|
124
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
125
|
-
Connection close
|
126
|
-
Actual: Test timeout
|
127
|
-
Sends a HEADERS frame with 0x0 stream identifier
|
128
24
|
✓ Sends a HEADERS frame with 0x0 stream identifier
|
129
|
-
Sends a HEADERS frame with invalid pad length
|
130
25
|
✓ Sends a HEADERS frame with invalid pad length
|
131
|
-
|
132
|
-
6.3. PRIORITY
|
133
|
-
Sends a PRIORITY frame with 0x0 stream identifier
|
134
26
|
✓ Sends a PRIORITY frame with 0x0 stream identifier
|
135
|
-
Sends a PRIORITY frame with a length other than 5 octets
|
136
27
|
× Sends a PRIORITY frame with a length other than 5 octets
|
137
|
-
- The endpoint MUST respond with a stream error of type FRAME_SIZE_ERROR.
|
138
|
-
Expected: GOAWAY frame (ErrorCode: FRAME_SIZE_ERROR)
|
139
|
-
RST_STREAM frame (ErrorCode: FRAME_SIZE_ERROR)
|
140
|
-
Connection close
|
141
|
-
Actual: GOAWAY frame (Length: 8, Flags: 0, ErrorCode: PROTOCOL_ERROR)
|
142
|
-
|
143
|
-
6.4. RST_STREAM
|
144
|
-
Sends a RST_STREAM frame with 0x0 stream identifier
|
145
28
|
✓ Sends a RST_STREAM frame with 0x0 stream identifier
|
146
|
-
Sends a RST_STREAM frame on a idle stream
|
147
29
|
✓ Sends a RST_STREAM frame on a idle stream
|
148
|
-
Sends a RST_STREAM frame with a length other than 4 octets
|
149
30
|
× Sends a RST_STREAM frame with a length other than 4 octets
|
150
|
-
- The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.
|
151
|
-
Expected: GOAWAY frame (ErrorCode: FRAME_SIZE_ERROR)
|
152
|
-
Connection close
|
153
|
-
Actual: GOAWAY frame (Length: 8, Flags: 0, ErrorCode: PROTOCOL_ERROR)
|
154
|
-
|
155
|
-
6.5. SETTINGS
|
156
|
-
Sends a SETTINGS frame
|
157
31
|
✓ Sends a SETTINGS frame
|
158
|
-
Sends a SETTINGS frame that is not a zero-length with ACK flag
|
159
32
|
✓ Sends a SETTINGS frame that is not a zero-length with ACK flag
|
160
|
-
Sends a SETTINGS frame with the stream identifier that is not 0x0
|
161
33
|
✓ Sends a SETTINGS frame with the stream identifier that is not 0x0
|
162
|
-
Sends a SETTINGS frame with a length other than a multiple of 6 octets
|
163
34
|
✓ Sends a SETTINGS frame with a length other than a multiple of 6 octets
|
164
|
-
|
165
|
-
6.5.2. Defined SETTINGS Parameters
|
166
|
-
SETTINGS_ENABLE_PUSH (0x2): Sends the value other than 0 or 1
|
167
35
|
✓ SETTINGS_ENABLE_PUSH (0x2): Sends the value other than 0 or 1
|
168
|
-
SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size
|
169
36
|
× SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size
|
170
|
-
- The endpoint MUST respond with a connection error of type FLOW_CONTROL_ERROR.
|
171
|
-
Expected: GOAWAY frame (ErrorCode: FLOW_CONTROL_ERROR)
|
172
|
-
Connection close
|
173
|
-
Actual: GOAWAY frame (Length: 8, Flags: 0, ErrorCode: PROTOCOL_ERROR)
|
174
|
-
SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value
|
175
37
|
✓ SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value
|
176
|
-
SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size
|
177
38
|
✓ SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size
|
178
|
-
|
179
|
-
6.7. PING
|
180
|
-
Sends a PING frame
|
181
39
|
✓ Sends a PING frame
|
182
|
-
Sends a PING frame with the stream identifier that is not 0x0
|
183
40
|
× Sends a PING frame with the stream identifier that is not 0x0
|
184
|
-
- The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.
|
185
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
186
|
-
Connection close
|
187
|
-
Actual: PING frame (Length: 8, Flags: 1)
|
188
|
-
Sends a PING frame with a length field value other than 8
|
189
41
|
✓ Sends a PING frame with a length field value other than 8
|
190
|
-
|
191
|
-
6.8. GOAWAY
|
192
|
-
Sends a GOAWAY frame with the stream identifier that is not 0x0
|
193
42
|
× Sends a GOAWAY frame with the stream identifier that is not 0x0
|
194
|
-
- The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.
|
195
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
196
|
-
Connection close
|
197
|
-
Actual: Test timeout
|
198
|
-
|
199
|
-
6.9. WINDOW_UPDATE
|
200
|
-
Sends a WINDOW_UPDATE frame
|
201
43
|
× Sends a WINDOW_UPDATE frame
|
202
|
-
- The endpoint is expected to send the DATA frame based on the window size.
|
203
|
-
Expected: DATA frame
|
204
|
-
Actual: Test timeout
|
205
|
-
Sends a WINDOW_UPDATE frame with a flow control window increment of 0
|
206
44
|
× Sends a WINDOW_UPDATE frame with a flow control window increment of 0
|
207
|
-
- The endpoint MUST respond with a connection error of type PROTOCOL_ERROR.
|
208
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
209
|
-
Connection close
|
210
|
-
Actual: Test timeout
|
211
|
-
Sends a WINDOW_UPDATE frame with a flow control window increment of 0 on a stream
|
212
45
|
× Sends a WINDOW_UPDATE frame with a flow control window increment of 0 on a stream
|
213
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
214
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
215
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
216
|
-
Connection close
|
217
|
-
Actual: SETTINGS frame (Length: 0, Flags: 1)
|
218
|
-
Sends a WINDOW_UPDATE frame with a length other than a multiple of 4 octets
|
219
46
|
× Sends a WINDOW_UPDATE frame with a length other than a multiple of 4 octets
|
220
|
-
- The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.
|
221
|
-
Expected: GOAWAY frame (ErrorCode: FRAME_SIZE_ERROR)
|
222
|
-
Connection close
|
223
|
-
Actual: GOAWAY frame (Length: 8, Flags: 0, ErrorCode: PROTOCOL_ERROR)
|
224
|
-
|
225
|
-
6.9.1. The Flow Control Window
|
226
|
-
Sends multiple WINDOW_UPDATE frames on a connection increasing the flow control window to above 2^31-1
|
227
47
|
× Sends multiple WINDOW_UPDATE frames on a connection increasing the flow control window to above 2^31-1
|
228
|
-
- The endpoint MUST sends a GOAWAY frame with a FLOW_CONTROL_ERROR code.
|
229
|
-
Expected: GOAWAY frame (ErrorCode: FLOW_CONTROL_ERROR)
|
230
|
-
Actual: Test timeout
|
231
|
-
Sends multiple WINDOW_UPDATE frames on a stream increasing the flow control window to above 2^31-1
|
232
48
|
× Sends multiple WINDOW_UPDATE frames on a stream increasing the flow control window to above 2^31-1
|
233
|
-
- The endpoint MUST send a RST_STREAM with the error code of FLOW_CONTROL_ERROR code.
|
234
|
-
Expected: RST_STREAM frame (ErrorCode: FLOW_CONTROL_ERROR)
|
235
|
-
GOAWAY frame (ErrorCode: FLOW_CONTROL_ERROR)
|
236
|
-
Actual: Test timeout
|
237
|
-
|
238
|
-
6.9.2. Initial Flow Control Window Size
|
239
|
-
Sends a SETTINGS_INITIAL_WINDOW_SIZE settings with an exceeded maximum window size value
|
240
49
|
× Sends a SETTINGS_INITIAL_WINDOW_SIZE settings with an exceeded maximum window size value
|
241
|
-
- The endpoint MUST respond with a connection error of type FLOW_CONTROL_ERROR.
|
242
|
-
Expected: GOAWAY frame (ErrorCode: FLOW_CONTROL_ERROR)
|
243
|
-
Connection close
|
244
|
-
Actual: GOAWAY frame (Length: 8, Flags: 0, ErrorCode: PROTOCOL_ERROR)
|
245
|
-
|
246
|
-
6.10. CONTINUATION
|
247
|
-
Sends a CONTINUATION frame
|
248
50
|
✓ Sends a CONTINUATION frame
|
249
|
-
Sends multiple CONTINUATION frames
|
250
51
|
✓ Sends multiple CONTINUATION frames
|
251
|
-
Sends a CONTINUATION frame followed by any frame other than CONTINUATION
|
252
52
|
× Sends a CONTINUATION frame followed by any frame other than CONTINUATION
|
253
|
-
- The endpoint MUST treat as a connection error of type PROTOCOL_ERROR.
|
254
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
255
|
-
Connection close
|
256
|
-
Actual: Test timeout
|
257
|
-
Sends a CONTINUATION frame followed by a frame on a different stream
|
258
53
|
✓ Sends a CONTINUATION frame followed by a frame on a different stream
|
259
|
-
Sends a CONTINUATION frame with the stream identifier that is 0x0
|
260
54
|
✓ Sends a CONTINUATION frame with the stream identifier that is 0x0
|
261
|
-
Sends a CONTINUATION frame after the frame other than HEADERS, PUSH_PROMISE or CONTINUATION
|
262
55
|
× Sends a CONTINUATION frame after the frame other than HEADERS, PUSH_PROMISE or CONTINUATION
|
263
|
-
- The endpoint MUST treat as a connection error of type PROTOCOL_ERROR.
|
264
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
265
|
-
Connection close
|
266
|
-
Actual: WINDOW_UPDATE frame (Length: 4, Flags: 0)
|
267
|
-
|
268
|
-
8.1. HTTP Request/Response Exchange
|
269
|
-
Sends a HEADERS frame as HEAD request
|
270
56
|
× Sends a HEADERS frame as HEAD request
|
271
|
-
- The endpoint should respond with no DATA frame or empty DATA frame.
|
272
|
-
Expected: HEADERS frame (Flags: 1)
|
273
|
-
DATA frame (Length: 0, Flags: 1)
|
274
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
275
|
-
Sends a HEADERS frame containing trailer part
|
276
57
|
✓ Sends a HEADERS frame containing trailer part
|
277
|
-
Sends a second HEADERS frame without the END_STREAM flag
|
278
58
|
× Sends a second HEADERS frame without the END_STREAM flag
|
279
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
280
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
281
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
282
|
-
Connection close
|
283
|
-
Actual: WINDOW_UPDATE frame (Length: 4, Flags: 0)
|
284
|
-
|
285
|
-
8.1.2. HTTP Header Fields
|
286
|
-
Sends a HEADERS frame that contains the header field name in uppercase letters
|
287
59
|
× Sends a HEADERS frame that contains the header field name in uppercase letters
|
288
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
289
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
290
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
291
|
-
Connection close
|
292
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
293
|
-
|
294
|
-
8.1.2.1. Pseudo-Header Fields
|
295
|
-
Sends a HEADERS frame that contains the pseudo-header field defined for response
|
296
60
|
× Sends a HEADERS frame that contains the pseudo-header field defined for response
|
297
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
298
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
299
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
300
|
-
Connection close
|
301
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
302
|
-
Sends a HEADERS frame that contains the invalid pseudo-header field
|
303
61
|
× Sends a HEADERS frame that contains the invalid pseudo-header field
|
304
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
305
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
306
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
307
|
-
Connection close
|
308
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
309
|
-
Sends a HEADERS frame that contains a pseudo-header field that appears in a header block after a regular header field
|
310
62
|
× Sends a HEADERS frame that contains a pseudo-header field that appears in a header block after a regular header field
|
311
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
312
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
313
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
314
|
-
Connection close
|
315
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
316
|
-
|
317
|
-
8.1.2.2. Connection-Specific Header Fields
|
318
|
-
Sends a HEADERS frame that contains the connection-specific header field
|
319
63
|
× Sends a HEADERS frame that contains the connection-specific header field
|
320
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
321
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
322
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
323
|
-
Connection close
|
324
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
325
|
-
Sends a HEADERS frame that contains the TE header field that contain any value other than "trailers"
|
326
64
|
× Sends a HEADERS frame that contains the TE header field that contain any value other than "trailers"
|
327
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
328
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
329
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
330
|
-
Connection close
|
331
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
332
|
-
|
333
|
-
8.1.2.3. Request Pseudo-Header Fields
|
334
|
-
Sends a HEADERS frame that omits mandatory pseudo-header fields
|
335
65
|
× Sends a HEADERS frame that omits mandatory pseudo-header fields
|
336
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
337
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
338
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
339
|
-
Connection close
|
340
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
341
|
-
Sends a HEADERS frame that omits just ':method' pseudo-header field.
|
342
66
|
× Sends a HEADERS frame that omits just ':method' pseudo-header field.
|
343
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
344
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
345
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
346
|
-
Connection close
|
347
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
348
|
-
Sends a HEADERS frame that omits just ':scheme' pseudo-header field.
|
349
67
|
× Sends a HEADERS frame that omits just ':scheme' pseudo-header field.
|
350
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
351
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
352
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
353
|
-
Connection close
|
354
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
355
|
-
Sends a HEADERS frame that omits just ':path' pseudo-header field.
|
356
68
|
× Sends a HEADERS frame that omits just ':path' pseudo-header field.
|
357
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
358
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
359
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
360
|
-
Connection close
|
361
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
362
|
-
Sends a HEADERS frame containing more than one pseudo-header fields with the same name
|
363
69
|
× Sends a HEADERS frame containing more than one pseudo-header fields with the same name
|
364
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
365
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
366
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
367
|
-
Connection close
|
368
|
-
Actual: DATA frame (Length: 22, Flags: 1)
|
369
|
-
|
370
|
-
8.1.2.6. Malformed Requests and Responses
|
371
|
-
Sends a HEADERS frame that contains the "content-length" header field which does not equal the sum of the DATA frame payload lengths
|
372
70
|
× Sends a HEADERS frame that contains the "content-length" header field which does not equal the sum of the DATA frame payload lengths
|
373
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
374
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
375
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
376
|
-
Connection close
|
377
|
-
Actual: DATA frame (Length: 29, Flags: 1)
|
378
|
-
Sends a HEADERS frame that contains the "content-length" header field which does not equal the sum of the multiple DATA frame payload lengths
|
379
71
|
× Sends a HEADERS frame that contains the "content-length" header field which does not equal the sum of the multiple DATA frame payload lengths
|
380
|
-
- The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
381
|
-
Expected: GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
|
382
|
-
RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
|
383
|
-
Connection close
|
384
|
-
Actual: DATA frame (Length: 33, Flags: 1)
|
385
|
-
|
386
|
-
8.2. Server Push
|
387
|
-
Sends a PUSH_PROMISE frame
|
388
72
|
✓ Sends a PUSH_PROMISE frame
|
389
|
-
|
390
|
-
73 tests, 33 passed, 0 skipped, 40 failed
|
data/spec/helper.rb
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
require './spec/support/deep_dup'
|
2
|
-
|
3
|
-
RSpec.configure(&:disable_monkey_patching!)
|
4
|
-
RSpec::Expectations.configuration.warn_about_potential_false_positives = false
|
5
|
-
|
6
|
-
require 'json'
|
7
|
-
require 'coveralls'
|
8
|
-
|
9
|
-
Coveralls.wear! if ENV['CI']
|
10
|
-
|
11
|
-
# rubocop: disable Style/MixinUsage
|
12
|
-
require 'http/2'
|
13
|
-
include HTTP2
|
14
|
-
include HTTP2::Header
|
15
|
-
include HTTP2::Error
|
16
|
-
# rubocop: enable Style/MixinUsage
|
17
|
-
|
18
|
-
REQUEST_HEADERS = [%w(:scheme https),
|
19
|
-
%w(:path /),
|
20
|
-
%w(:authority example.com),
|
21
|
-
%w(:method GET),
|
22
|
-
%w(a b)].freeze
|
23
|
-
RESPONSE_HEADERS = [%w(:status 200)].freeze
|
24
|
-
|
25
|
-
module FrameHelpers
|
26
|
-
def data_frame
|
27
|
-
{
|
28
|
-
type: :data,
|
29
|
-
flags: [:end_stream],
|
30
|
-
stream: 1,
|
31
|
-
payload: 'text',
|
32
|
-
}
|
33
|
-
end
|
34
|
-
|
35
|
-
def headers_frame
|
36
|
-
{
|
37
|
-
type: :headers,
|
38
|
-
flags: [:end_headers].freeze,
|
39
|
-
stream: 1,
|
40
|
-
payload: Compressor.new.encode(REQUEST_HEADERS),
|
41
|
-
}
|
42
|
-
end
|
43
|
-
|
44
|
-
def priority_frame
|
45
|
-
{
|
46
|
-
type: :priority,
|
47
|
-
stream: 1,
|
48
|
-
exclusive: false,
|
49
|
-
stream_dependency: 0,
|
50
|
-
weight: 20,
|
51
|
-
}
|
52
|
-
end
|
53
|
-
|
54
|
-
def rst_stream_frame
|
55
|
-
{
|
56
|
-
type: :rst_stream,
|
57
|
-
stream: 1,
|
58
|
-
error: :stream_closed,
|
59
|
-
}
|
60
|
-
end
|
61
|
-
|
62
|
-
def settings_frame
|
63
|
-
{
|
64
|
-
type: :settings,
|
65
|
-
stream: 0,
|
66
|
-
payload: [
|
67
|
-
[:settings_max_concurrent_streams, 10],
|
68
|
-
[:settings_initial_window_size, 0x7fffffff],
|
69
|
-
],
|
70
|
-
}
|
71
|
-
end
|
72
|
-
|
73
|
-
def push_promise_frame
|
74
|
-
{
|
75
|
-
type: :push_promise,
|
76
|
-
flags: [:end_headers],
|
77
|
-
stream: 1,
|
78
|
-
promise_stream: 2,
|
79
|
-
payload: Compressor.new.encode([%w(a b)]),
|
80
|
-
}
|
81
|
-
end
|
82
|
-
|
83
|
-
def ping_frame
|
84
|
-
{
|
85
|
-
stream: 0,
|
86
|
-
type: :ping,
|
87
|
-
payload: '12345678',
|
88
|
-
}
|
89
|
-
end
|
90
|
-
|
91
|
-
def pong_frame
|
92
|
-
{
|
93
|
-
stream: 0,
|
94
|
-
type: :ping,
|
95
|
-
flags: [:ack],
|
96
|
-
payload: '12345678',
|
97
|
-
}
|
98
|
-
end
|
99
|
-
|
100
|
-
def goaway_frame
|
101
|
-
{
|
102
|
-
type: :goaway,
|
103
|
-
last_stream: 2,
|
104
|
-
error: :no_error,
|
105
|
-
payload: 'debug',
|
106
|
-
}
|
107
|
-
end
|
108
|
-
|
109
|
-
def window_update_frame
|
110
|
-
{
|
111
|
-
type: :window_update,
|
112
|
-
increment: 10,
|
113
|
-
}
|
114
|
-
end
|
115
|
-
|
116
|
-
def continuation_frame
|
117
|
-
{
|
118
|
-
type: :continuation,
|
119
|
-
flags: [:end_headers],
|
120
|
-
payload: '-second-block',
|
121
|
-
}
|
122
|
-
end
|
123
|
-
|
124
|
-
def altsvc_frame
|
125
|
-
{
|
126
|
-
type: :altsvc,
|
127
|
-
max_age: 1_402_290_402, # 4
|
128
|
-
port: 8080, # 2 reserved 1
|
129
|
-
proto: 'h2-12', # 1 + 5
|
130
|
-
host: 'www.example.com', # 1 + 15
|
131
|
-
origin: 'www.example.com' # 15
|
132
|
-
}
|
133
|
-
end
|
134
|
-
|
135
|
-
def frame_types
|
136
|
-
methods.select { |meth| meth.to_s.end_with?('_frame') }
|
137
|
-
.map { |meth| __send__(meth) }
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def set_stream_id(bytes, id)
|
142
|
-
scheme = 'CnCCN'.freeze
|
143
|
-
head = bytes.slice!(0, 9).unpack(scheme)
|
144
|
-
head[4] = id
|
145
|
-
|
146
|
-
head.pack(scheme) + bytes
|
147
|
-
end
|
data/spec/hpack_test_spec.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
RSpec.describe HTTP2::Header do
|
5
|
-
folders = %w(
|
6
|
-
go-hpack
|
7
|
-
haskell-http2-diff
|
8
|
-
haskell-http2-diff-huffman
|
9
|
-
haskell-http2-linear
|
10
|
-
haskell-http2-linear-huffman
|
11
|
-
haskell-http2-naive
|
12
|
-
haskell-http2-naive-huffman
|
13
|
-
haskell-http2-static
|
14
|
-
haskell-http2-static-huffman
|
15
|
-
#hyper-hpack
|
16
|
-
nghttp2
|
17
|
-
nghttp2-16384-4096
|
18
|
-
nghttp2-change-table-size
|
19
|
-
node-http2-hpack
|
20
|
-
)
|
21
|
-
|
22
|
-
context 'Decompressor' do
|
23
|
-
folders.each do |folder|
|
24
|
-
next if folder =~ /#/
|
25
|
-
path = File.expand_path("hpack-test-case/#{folder}", File.dirname(__FILE__))
|
26
|
-
next unless Dir.exist?(path)
|
27
|
-
context folder.to_s do
|
28
|
-
Dir.foreach(path) do |file|
|
29
|
-
next if file !~ /\.json/
|
30
|
-
it "should decode #{file}" do
|
31
|
-
story = JSON.parse(File.read("#{path}/#{file}"))
|
32
|
-
cases = story['cases']
|
33
|
-
table_size = cases[0]['header_table_size'] || 4096
|
34
|
-
@dc = Decompressor.new(table_size: table_size)
|
35
|
-
cases.each do |c|
|
36
|
-
wire = [c['wire']].pack('H*').force_encoding(Encoding::BINARY)
|
37
|
-
@emitted = @dc.decode(HTTP2::Buffer.new(wire))
|
38
|
-
headers = c['headers'].flat_map(&:to_a)
|
39
|
-
expect(@emitted).to eq headers
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context 'Compressor' do
|
48
|
-
%w(
|
49
|
-
LINEAR
|
50
|
-
NAIVE
|
51
|
-
SHORTER
|
52
|
-
STATIC
|
53
|
-
).each do |mode|
|
54
|
-
next if mode =~ /#/
|
55
|
-
['', 'H'].each do |huffman|
|
56
|
-
encoding_mode = "#{mode}#{huffman}".to_sym
|
57
|
-
encoding_options = HTTP2::Header::EncodingContext.const_get(encoding_mode)
|
58
|
-
[4096, 512].each do |table_size|
|
59
|
-
options = { table_size: table_size }
|
60
|
-
options.update(encoding_options)
|
61
|
-
|
62
|
-
context "with #{mode}#{huffman} mode and table_size #{table_size}" do
|
63
|
-
path = File.expand_path('hpack-test-case/raw-data', File.dirname(__FILE__))
|
64
|
-
Dir.foreach(path) do |file|
|
65
|
-
next if file !~ /\.json/
|
66
|
-
it "should encode #{file}" do
|
67
|
-
story = JSON.parse(File.read("#{path}/#{file}"))
|
68
|
-
cases = story['cases']
|
69
|
-
@cc = Compressor .new(options)
|
70
|
-
@dc = Decompressor.new(options)
|
71
|
-
cases.each do |c|
|
72
|
-
headers = c['headers'].flat_map(&:to_a)
|
73
|
-
wire = @cc.encode(headers)
|
74
|
-
decoded = @dc.decode(HTTP2::Buffer.new(wire))
|
75
|
-
expect(decoded).to eq headers
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
data/spec/huffman_spec.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
RSpec.describe HTTP2::Header::Huffman do
|
4
|
-
huffman_examples = [ # plain, encoded
|
5
|
-
['www.example.com', 'f1e3c2e5f23a6ba0ab90f4ff'],
|
6
|
-
['no-cache', 'a8eb10649cbf'],
|
7
|
-
['Mon, 21 Oct 2013 20:13:21 GMT', 'd07abe941054d444a8200595040b8166e082a62d1bff'],
|
8
|
-
]
|
9
|
-
context 'encode' do
|
10
|
-
before(:all) { @encoder = HTTP2::Header::Huffman.new }
|
11
|
-
huffman_examples.each do |plain, encoded|
|
12
|
-
it "should encode #{plain} into #{encoded}" do
|
13
|
-
expect(@encoder.encode(plain).unpack('H*').first).to eq encoded
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
context 'decode' do
|
18
|
-
before(:all) { @encoder = HTTP2::Header::Huffman.new }
|
19
|
-
huffman_examples.each do |plain, encoded|
|
20
|
-
it "should decode #{encoded} into #{plain}" do
|
21
|
-
expect(@encoder.decode(HTTP2::Buffer.new([encoded].pack('H*')))).to eq plain
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
[
|
26
|
-
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0',
|
27
|
-
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
28
|
-
'http://www.craigslist.org/about/sites/',
|
29
|
-
'cl_b=AB2BKbsl4hGM7M4nH5PYWghTM5A; cl_def_lang=en; cl_def_hp=shoals',
|
30
|
-
'image/png,image/*;q=0.8,*/*;q=0.5',
|
31
|
-
'BX=c99r6jp89a7no&b=3&s=q4; localization=en-us%3Bus%3Bus',
|
32
|
-
'UTF-8でエンコードした日本語文字列',
|
33
|
-
].each do |string|
|
34
|
-
it "should encode then decode '#{string}' into the same" do
|
35
|
-
s = string.dup.force_encoding(Encoding::BINARY)
|
36
|
-
encoded = @encoder.encode(s)
|
37
|
-
expect(@encoder.decode(HTTP2::Buffer.new(encoded))).to eq s
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'should encode/decode all_possible 2-byte sequences' do
|
42
|
-
(2**16).times do |n|
|
43
|
-
str = [n].pack('V')[0, 2].force_encoding(Encoding::BINARY)
|
44
|
-
expect(@encoder.decode(HTTP2::Buffer.new(@encoder.encode(str)))).to eq str
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'should raise when input is shorter than expected' do
|
49
|
-
encoded = huffman_examples.first.last
|
50
|
-
encoded = [encoded].pack('H*')
|
51
|
-
expect { @encoder.decode(HTTP2::Buffer.new(encoded[0...-1])) }.to raise_error(/EOS invalid/)
|
52
|
-
end
|
53
|
-
it 'should raise when input is not padded by 1s' do
|
54
|
-
encoded = 'f1e3c2e5f23a6ba0ab90f4fe' # note the fe at end
|
55
|
-
encoded = [encoded].pack('H*')
|
56
|
-
expect { @encoder.decode(HTTP2::Buffer.new(encoded)) }.to raise_error(/EOS invalid/)
|
57
|
-
end
|
58
|
-
it 'should raise when exceedingly padded' do
|
59
|
-
encoded = 'e7cf9bebe89b6fb16fa9b6ffff' # note the extra ff
|
60
|
-
encoded = [encoded].pack('H*')
|
61
|
-
expect { @encoder.decode(HTTP2::Buffer.new(encoded)) }.to raise_error(/EOS invalid/)
|
62
|
-
end
|
63
|
-
it 'should raise when EOS is explicitly encoded' do
|
64
|
-
encoded = ['1c7fffffffff'].pack('H*') # a b EOS
|
65
|
-
expect { @encoder.decode(HTTP2::Buffer.new(encoded)) }.to raise_error(/EOS found/)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|