# HG changeset patch # User Sergey Kandaurov # Date 1673615541 -14400 # Node ID ff50c265a5acd2e5fc989256bd8bd74671ecdc93 # Parent 3619dcc8ba6dd812242eea795bc0deb0f96b3b6d Tests: HTTP/3 tests with streams blocked on insert count. As QUIC streams are run postponed, make sure to give it a chance to run before receiving RESET_STREAM, such that the request is read. diff --git a/h3_headers.t b/h3_headers.t --- a/h3_headers.t +++ b/h3_headers.t @@ -27,7 +27,7 @@ eval { require Crypt::Misc; die if $Cryp plan(skip_all => 'CryptX version >= 0.067 required') if $@; my $t = Test::Nginx->new()->has(qw/http http_v3 proxy rewrite/) - ->has_daemon('openssl')->plan(66) + ->has_daemon('openssl')->plan(68) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -110,6 +110,13 @@ http { ignore_invalid_headers off; add_header X-Sent-Foo $http_x_foo always; } + + server { + listen 127.0.0.1:%%PORT_8988_UDP%% quic; + server_name localhost; + + client_header_timeout 1s; + } } EOF @@ -854,6 +861,25 @@ is($frame->{headers}->{':status'}, 400, ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; is($frame->{headers}->{':status'}, 400, 'invalid path control'); +# stream blocked on insert count + +$s = Test::Nginx::HTTP3->new(); +$sid = $s->new_stream({ ric => 3 }); +select undef, undef, undef, 0.2; + +$s->reset_stream($sid, 0x010c); +$frames = $s->read(all => [{ sid => $sid, fin => 1 }]); + +($frame) = grep { $_->{type} eq "HEADERS" } @$frames; +is($frame->{headers}->{':status'}, '400', 'blocked insert reset - bad request'); + +$s = Test::Nginx::HTTP3->new(8988); +$sid = $s->new_stream({ ric => 3 }); +$frames = $s->read(all => [{ type => 'RESET_STREAM' }]); + +($frame) = grep { $_->{type} eq "RESET_STREAM" } @$frames; +is($frame->{sid}, $sid, 'blocked insert timeout - RESET_STREAM'); + ############################################################################### sub http_daemon { diff --git a/lib/Test/Nginx/HTTP3.pm b/lib/Test/Nginx/HTTP3.pm --- a/lib/Test/Nginx/HTTP3.pm +++ b/lib/Test/Nginx/HTTP3.pm @@ -419,7 +419,7 @@ sub new_stream { # encoded field section prefix my $table = $self->{dynamic_encode}; - my $ric = scalar @$table ? scalar @$table + 1 : 0; + my $ric = $uri->{ric} ? $uri->{ric} : @$table ? @$table + 1 : 0; my $base = $uri->{base} || 0; $base = $base < 0 ? 0x80 + abs($base) - 1 : $base; $input = pack("CC", $ric, $base) . $input;