Mercurial > hg > nginx-tests
comparison 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 |
comparison
equal
deleted
inserted
replaced
1882:3619dcc8ba6d | 1883:ff50c265a5ac |
---|---|
25 | 25 |
26 eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; }; | 26 eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; }; |
27 plan(skip_all => 'CryptX version >= 0.067 required') if $@; | 27 plan(skip_all => 'CryptX version >= 0.067 required') if $@; |
28 | 28 |
29 my $t = Test::Nginx->new()->has(qw/http http_v3 proxy rewrite/) | 29 my $t = Test::Nginx->new()->has(qw/http http_v3 proxy rewrite/) |
30 ->has_daemon('openssl')->plan(66) | 30 ->has_daemon('openssl')->plan(68) |
31 ->write_file_expand('nginx.conf', <<'EOF'); | 31 ->write_file_expand('nginx.conf', <<'EOF'); |
32 | 32 |
33 %%TEST_GLOBALS%% | 33 %%TEST_GLOBALS%% |
34 | 34 |
35 daemon off; | 35 daemon off; |
107 listen 127.0.0.1:%%PORT_8987_UDP%% quic; | 107 listen 127.0.0.1:%%PORT_8987_UDP%% quic; |
108 server_name localhost; | 108 server_name localhost; |
109 | 109 |
110 ignore_invalid_headers off; | 110 ignore_invalid_headers off; |
111 add_header X-Sent-Foo $http_x_foo always; | 111 add_header X-Sent-Foo $http_x_foo always; |
112 } | |
113 | |
114 server { | |
115 listen 127.0.0.1:%%PORT_8988_UDP%% quic; | |
116 server_name localhost; | |
117 | |
118 client_header_timeout 1s; | |
112 } | 119 } |
113 } | 120 } |
114 | 121 |
115 EOF | 122 EOF |
116 | 123 |
851 $sid = $s->new_stream({ path => "/t2.html\x02" }); | 858 $sid = $s->new_stream({ path => "/t2.html\x02" }); |
852 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); | 859 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
853 | 860 |
854 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 861 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
855 is($frame->{headers}->{':status'}, 400, 'invalid path control'); | 862 is($frame->{headers}->{':status'}, 400, 'invalid path control'); |
863 | |
864 # stream blocked on insert count | |
865 | |
866 $s = Test::Nginx::HTTP3->new(); | |
867 $sid = $s->new_stream({ ric => 3 }); | |
868 select undef, undef, undef, 0.2; | |
869 | |
870 $s->reset_stream($sid, 0x010c); | |
871 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); | |
872 | |
873 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
874 is($frame->{headers}->{':status'}, '400', 'blocked insert reset - bad request'); | |
875 | |
876 $s = Test::Nginx::HTTP3->new(8988); | |
877 $sid = $s->new_stream({ ric => 3 }); | |
878 $frames = $s->read(all => [{ type => 'RESET_STREAM' }]); | |
879 | |
880 ($frame) = grep { $_->{type} eq "RESET_STREAM" } @$frames; | |
881 is($frame->{sid}, $sid, 'blocked insert timeout - RESET_STREAM'); | |
856 | 882 |
857 ############################################################################### | 883 ############################################################################### |
858 | 884 |
859 sub http_daemon { | 885 sub http_daemon { |
860 my $server = IO::Socket::INET->new( | 886 my $server = IO::Socket::INET->new( |