changeset 1091:a5e428f4440d

Tests: added request body buffering test for requests without body.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 12 Dec 2016 10:51:33 +0300
parents 9d6a0dbb889a
children f72f43eda2a6
files h2_request_body.t
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 {