diff h3_headers.t @ 1883:ff50c265a5ac

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.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 13 Jan 2023 17:12:21 +0400
parents 74cb9454a13e
children 8b74936ff2ac
line wrap: on
line diff
--- 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 {