# HG changeset patch # User Sergey Kandaurov # Date 1601551714 -3600 # Node ID 36d69685605ed66162c7e1fef4725066473617bb # Parent f42d82b114cdf0613da907e9e0cdc935d7c6d1c8 Tests: added HTTP/2 tests for DATA frames after 400 errors. diff --git a/h2_request_body.t b/h2_request_body.t --- a/h2_request_body.t +++ b/h2_request_body.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/)->plan(44); +my $t = Test::Nginx->new()->has(qw/http http_v2 proxy/)->plan(45); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -42,6 +42,8 @@ http { listen 127.0.0.1:8081; server_name localhost; + error_page 400 /proxy2/t.html; + location / { add_header X-Length $http_content_length; } @@ -461,6 +463,22 @@ select undef, undef, undef, 0.1; ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; isnt($frame->{headers}->{'x-body'}, 'xxxx', 'sync buffer'); +# request body after 400 errors redirected to a proxied location + +TODO: { +todo_skip 'leaves coredump', 1 unless $ENV{TEST_NGINX_UNSAFE} + or $t->has_version('1.19.3'); + +$s = Test::Nginx::HTTP2->new(); +$sid = $s->new_stream({ body => "", headers => [ + { name => ':method', value => "" }]}); + +$frames = $s->read(all => [{ sid => $sid, fin => 1 }]); +($frame) = grep { $_->{type} eq 'DATA' } @$frames; +is($frame->{data}, 'SEE-THIS', 'request body after 400 redirect'); + +} + ############################################################################### sub read_body_file {