comparison grpc.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 e3dd111410fe
children b27bcded6449
comparison
equal deleted inserted replaced
1714:e4e711d07e6c 1715:3604ef83c1aa
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 rewrite http_v2 grpc/) 26 my $t = Test::Nginx->new()->has(qw/http rewrite http_v2 grpc/)
27 ->has(qw/upstream_keepalive/)->plan(145); 27 ->has(qw/upstream_keepalive/)->plan(146);
28 28
29 $t->write_file_expand('nginx.conf', <<'EOF'); 29 $t->write_file_expand('nginx.conf', <<'EOF');
30 30
31 %%TEST_GLOBALS%% 31 %%TEST_GLOBALS%%
32 32
501 $f->{http_start}('/'); 501 $f->{http_start}('/');
502 $f->{data}('Hello'); 502 $f->{data}('Hello');
503 $frames = $f->{field_bad}(n => "n\nn"); 503 $frames = $f->{field_bad}(n => "n\nn");
504 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 504 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
505 is($frame->{headers}{':status'}, 502, 'invalid header name ctl'); 505 is($frame->{headers}{':status'}, 502, 'invalid header name ctl');
506
507 TODO: {
508 local $TODO = 'not yet' unless $t->has_version('1.21.1');
509
510 $f->{http_start}('/');
511 $f->{data}('Hello');
512 $frames = $f->{field_bad}(n => "n n");
513 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
514 is($frame->{headers}{':status'}, 502, 'invalid header name space');
515
516 }
506 517
507 $f->{http_start}('/'); 518 $f->{http_start}('/');
508 $f->{data}('Hello'); 519 $f->{data}('Hello');
509 $frames = $f->{field_bad}(v => "v\nv"); 520 $frames = $f->{field_bad}(v => "v\nv");
510 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 521 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;