comparison h2.t @ 1183:878696cb8510

Tests: added HTTP/2 SETTINGS test for no ack on PROTOCOL_ERROR.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 06 Jun 2017 15:50:45 +0300
parents 83c88a830a45
children 89b4bdd1346a
comparison
equal deleted inserted replaced
1182:83c88a830a45 1183:878696cb8510
24 24
25 select STDERR; $| = 1; 25 select STDERR; $| = 1;
26 select STDOUT; $| = 1; 26 select STDOUT; $| = 1;
27 27
28 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite charset gzip/) 28 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite charset gzip/)
29 ->plan(141); 29 ->plan(143);
30 30
31 $t->write_file_expand('nginx.conf', <<'EOF'); 31 $t->write_file_expand('nginx.conf', <<'EOF');
32 32
33 %%TEST_GLOBALS%% 33 %%TEST_GLOBALS%%
34 34
208 208
209 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames; 209 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames;
210 ok($frame, 'SETTINGS frame ack'); 210 ok($frame, 'SETTINGS frame ack');
211 is($frame->{flags}, 1, 'SETTINGS flags ack'); 211 is($frame->{flags}, 1, 'SETTINGS flags ack');
212 212
213 # SETTINGS - no ack on PROTOCOL_ERROR
214
215 $s = Test::Nginx::HTTP2->new(port(8080), pure => 1);
216 $frames = $s->read(all => [
217 { type => 'WINDOW_UPDATE' },
218 { type => 'SETTINGS'}
219 ]);
220
221 $s->h2_settings(1);
222 $s->h2_settings(0, 0x5 => 42);
223
224 $frames = $s->read(all => [
225 { type => 'SETTINGS'},
226 { type => 'GOAWAY' }
227 ]);
228
229 TODO: {
230 local $TODO = 'not yet' unless $t->has_version('1.13.2');
231
232 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames;
233 is($frame, undef, 'SETTINGS PROTOCOL_ERROR - no ack');
234
235 }
236
237 ($frame) = grep { $_->{type} eq 'GOAWAY' } @$frames;
238 ok($frame, 'SETTINGS PROTOCOL_ERROR - GOAWAY');
239
213 # PING 240 # PING
214 241
242 $s = Test::Nginx::HTTP2->new();
215 $s->h2_ping('SEE-THIS'); 243 $s->h2_ping('SEE-THIS');
216 $frames = $s->read(all => [{ type => 'PING' }]); 244 $frames = $s->read(all => [{ type => 'PING' }]);
217 245
218 ($frame) = grep { $_->{type} eq "PING" } @$frames; 246 ($frame) = grep { $_->{type} eq "PING" } @$frames;
219 ok($frame, 'PING frame'); 247 ok($frame, 'PING frame');