comparison h2.t @ 1548:b02d0fd71638

Tests: added HTTP/2 test for HEADERS split on field boundary.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 05 Feb 2020 18:02:04 +0300
parents 93633a10e33d
children f145dce55f32
comparison
equal deleted inserted replaced
1547:2d747d967fc0 1548:b02d0fd71638
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(147); 29 ->plan(150);
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
654 $frames = $s->read(all => [{ type => 'PING' }]); 654 $frames = $s->read(all => [{ type => 'PING' }]);
655 655
656 ($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames; 656 ($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames;
657 ok($frame, 'client header timeout - PING'); 657 ok($frame, 'client header timeout - PING');
658 658
659 # partial request header frame received (no field split),
660 # the rest of frame is received after client header timeout
661
662 $s = Test::Nginx::HTTP2->new(port(8087));
663 $sid = $s->new_stream({ path => '/t2.html', split => [20], split_delay => 2.1 });
664 $frames = $s->read(all => [{ type => 'RST_STREAM' }]);
665
666 TODO: {
667 local $TODO = 'not yet' unless $t->has_version('1.17.9');
668
669 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames;
670 ok($frame, 'client header timeout 2');
671 is($frame->{code}, 1, 'client header timeout 2 - protocol error');
672
673 }
674
675 $s->h2_ping('SEE-THIS');
676 $frames = $s->read(all => [{ type => 'PING' }]);
677
678 ($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames;
679 ok($frame, 'client header timeout 2 - PING');
680
659 # partial request body data frame received, the rest is after body timeout 681 # partial request body data frame received, the rest is after body timeout
660 682
661 $s = Test::Nginx::HTTP2->new(port(8087)); 683 $s = Test::Nginx::HTTP2->new(port(8087));
662 $sid = $s->new_stream({ path => '/proxy/t2.html', body_more => 1 }); 684 $sid = $s->new_stream({ path => '/proxy/t2.html', body_more => 1 });
663 $s->h2_body('TEST', { split => [10], split_delay => 2.1 }); 685 $s->h2_body('TEST', { split => [10], split_delay => 2.1 });