Mercurial > hg > nginx-tests
comparison h2_headers.t @ 1550:5c96745988c4
Tests: added HTTP/2 test for invalid index in literal header field.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 07 Feb 2020 17:21:46 +0300 |
parents | 6c9e3e20af97 |
children | 259dfb223f9a |
comparison
equal
deleted
inserted
replaced
1549:6c9e3e20af97 | 1550:5c96745988c4 |
---|---|
21 ############################################################################### | 21 ############################################################################### |
22 | 22 |
23 select STDERR; $| = 1; | 23 select STDERR; $| = 1; |
24 select STDOUT; $| = 1; | 24 select STDOUT; $| = 1; |
25 | 25 |
26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite/)->plan(103) | 26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite/)->plan(104) |
27 ->write_file_expand('nginx.conf', <<'EOF'); | 27 ->write_file_expand('nginx.conf', <<'EOF'); |
28 | 28 |
29 %%TEST_GLOBALS%% | 29 %%TEST_GLOBALS%% |
30 | 30 |
31 daemon off; | 31 daemon off; |
468 { name => ':path', value => '/', mode => 0 }, | 468 { name => ':path', value => '/', mode => 0 }, |
469 { name => ':authority', value => 'localhost', mode => 1 }, | 469 { name => ':authority', value => 'localhost', mode => 1 }, |
470 { name => 'referer', value => 'foo', mode => 0 }]}); | 470 { name => 'referer', value => 'foo', mode => 0 }]}); |
471 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); | 471 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
472 | 472 |
473 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 473 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
474 is($frame, undef, 'invalid index'); | 474 is($frame->{code}, 0x9, 'invalid index'); |
475 | |
476 $s = Test::Nginx::HTTP2->new(); | |
477 $sid = $s->new_stream({ headers => [ | |
478 { name => ':method', value => 'GET', mode => 0 }, | |
479 { name => ':scheme', value => 'http', mode => 0 }, | |
480 { name => ':path', value => '/', mode => 0 }, | |
481 { name => ':authority', value => 'localhost', mode => 1 }, | |
482 { name => 'unknown', value => 'foo', mode => 3 }]}); | |
483 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); | |
484 | |
485 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | |
486 is($frame->{code}, 0x9, 'invalid index in literal header field'); | |
475 | 487 |
476 # 5.4.1. Connection Error Handling | 488 # 5.4.1. Connection Error Handling |
477 # An endpoint that encounters a connection error SHOULD first send a | 489 # An endpoint that encounters a connection error SHOULD first send a |
478 # GOAWAY frame <..> | 490 # GOAWAY frame <..> |
479 | 491 |