# HG changeset patch # User Sergey Kandaurov # Date 1481529093 -10800 # Node ID a5e428f4440df7ed85217ee9722253a9d9757856 # Parent 9d6a0dbb889abd3224e7bfa06e93461f224e0bda Tests: added request body buffering test for requests without body. 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(42); +my $t = Test::Nginx->new()->has(qw/http http_v2 proxy/)->plan(43); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -45,6 +45,10 @@ http { location / { add_header X-Length $http_content_length; } + location /off/ { + proxy_pass http://127.0.0.1:8081/; + add_header X-Body-File $request_body_file; + } location /proxy2/ { add_header X-Body $request_body; add_header X-Body-File $request_body_file; @@ -422,6 +426,16 @@ is(read_body_file($frame->{headers}->{'x is($frame->{headers}->{':status'}, 413, 'request body without content-length many pad - limited'); +# absent request body is not buffered with client_body_in_file_only off +# see e02f1977846b for details + +$s = Test::Nginx::HTTP2->new(); +$sid = $s->new_stream({ path => '/off/t.html' }); +$frames = $s->read(all => [{ sid => $sid, fin => 1 }]); + +($frame) = grep { $_->{type} eq "HEADERS" } @$frames; +is($frame->{headers}->{'x-body-file'}, undef, 'no request body in file'); + ############################################################################### sub read_body_file {