# HG changeset patch # User Sergey Kandaurov # Date 1631895391 -10800 # Node ID f7170c7acf3aa4df97a4f24c0b7361ca3e0e5b2e # Parent e306bd77321d56716eade08eb083e76fa9c25780 Tests: added HTTP/2 tests for PUSH_PROMISE with CONTINUATION. diff --git a/h2_server_push.t b/h2_server_push.t --- a/h2_server_push.t +++ b/h2_server_push.t @@ -23,7 +23,7 @@ use Test::Nginx::HTTP2; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite gzip/)->plan(42) +my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite gzip/)->plan(54) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -106,6 +106,11 @@ http { return 204; } + location /continuation { + http2_push /push?arg="$args$args$args$args"; + return 204; + } + location /push { return 200 PROMISED; } @@ -420,6 +425,30 @@ gunzip_like($frame->{data}, qr/^PROMISED ($frame) = grep { $_->{type} eq "PUSH_PROMISE" && $_->{sid} == $sid } @$frames; is($frame->{headers}->{':scheme'}, 'https', 'scheme https'); +# CONTINUATION + +$s = Test::Nginx::HTTP2->new(); +$sid = $s->new_stream({ path => '/continuation?x=' . ('X' x 4096) }); +$frames = $s->read(all => [{ sid => 1, fin => 1 }, { sid => 2, fin => 1 }]); + +@$frames = grep { $_->{promised} } @$frames; +is(@$frames, 2, 'continuation - frames'); + +$frame = shift @$frames; +is($frame->{type}, 'PUSH_PROMISE', 'continuation - PUSH_PROMISE'); +is($frame->{length}, 16384, 'continuation - PUSH_PROMISE length'); +is($frame->{flags}, 0, 'continuation - PUSH_PROMISE flags'); +is($frame->{sid}, $sid, 'continuation - PUSH_PROMISE sid'); +is($frame->{promised}, 2, 'continuation - promised stream'); + +$frame = shift @$frames; +is($frame->{type}, 'CONTINUATION', 'continuation - CONTINUATION'); +is($frame->{flags}, 4, 'continuation - CONTINUATION flags'); +is($frame->{headers}->{':authority'}, 'localhost', 'continuation - authority'); +is($frame->{headers}->{':scheme'}, 'http', 'continuation - scheme'); +is($frame->{headers}->{':method'}, 'GET', 'continuation - method'); +like($frame->{headers}->{':path'}, qr!^/push!, 'continuation - path'); + ############################################################################### sub gunzip_like {