Mercurial > hg > nginx-tests
comparison h2_headers.t @ 1715:3604ef83c1aa
Tests: added header name tests with forbidden characters.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 29 Jun 2021 12:00:07 +0300 |
parents | e4e711d07e6c |
children | 3052d6ea8ff3 |
comparison
equal
deleted
inserted
replaced
1714:e4e711d07e6c | 1715:3604ef83c1aa |
---|---|
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(105) | 26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite/)->plan(107) |
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; |
991 | 991 |
992 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; | 992 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; |
993 is($frame->{sid}, $sid, 'colon in header name - RST_STREAM sid'); | 993 is($frame->{sid}, $sid, 'colon in header name - RST_STREAM sid'); |
994 is($frame->{code}, 1, 'colon in header name - RST_STREAM code'); | 994 is($frame->{code}, 1, 'colon in header name - RST_STREAM code'); |
995 | 995 |
996 TODO: { | |
997 local $TODO = 'not yet' unless $t->has_version('1.21.1'); | |
998 | |
999 $s = Test::Nginx::HTTP2->new(); | |
1000 $sid = $s->new_stream({ headers => [ | |
1001 { name => ':method', value => 'GET', mode => 0 }, | |
1002 { name => ':scheme', value => 'http', mode => 0 }, | |
1003 { name => ':path', value => '/', mode => 0 }, | |
1004 { name => ':authority', value => 'localhost', mode => 1 }, | |
1005 { name => 'x foo', value => "bar", mode => 2 }]}); | |
1006 $frames = $s->read(all => [{ type => 'RST_STREAM' }]); | |
1007 | |
1008 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; | |
1009 ok($frame, 'space in header name - RST_STREAM sid'); | |
1010 | |
1011 $s = Test::Nginx::HTTP2->new(); | |
1012 $sid = $s->new_stream({ headers => [ | |
1013 { name => ':method', value => 'GET', mode => 0 }, | |
1014 { name => ':scheme', value => 'http', mode => 0 }, | |
1015 { name => ':path', value => '/', mode => 0 }, | |
1016 { name => ':authority', value => 'localhost', mode => 1 }, | |
1017 { name => "foo\x02", value => "bar", mode => 2 }]}); | |
1018 $frames = $s->read(all => [{ type => 'RST_STREAM' }]); | |
1019 | |
1020 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; | |
1021 ok($frame, 'control in header name - RST_STREAM sid'); | |
1022 | |
1023 } | |
1024 | |
996 # header name with underscore - underscores_in_headers on | 1025 # header name with underscore - underscores_in_headers on |
997 | 1026 |
998 $s = Test::Nginx::HTTP2->new(port(8086)); | 1027 $s = Test::Nginx::HTTP2->new(port(8086)); |
999 $sid = $s->new_stream({ headers => [ | 1028 $sid = $s->new_stream({ headers => [ |
1000 { name => ':method', value => 'GET', mode => 0 }, | 1029 { name => ':method', value => 'GET', mode => 0 }, |