changeset 754:84a52b6d6343

Tests: HTTP/2 regression test for incomplete HEADERS payload.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 28 Oct 2015 00:11:42 +0300
parents 63d1b7cb974a
children f95aa716624e
files h2.t
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/h2.t
+++ b/h2.t
@@ -2247,6 +2247,11 @@ is($frame->{headers}->{':status'}, 400, 
 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
 is($frame->{headers}->{':status'}, 400, 'empty authority');
 
+# aborted stream with zero HEADERS payload followed by client connection close
+
+new_stream(new_session(), { split => [ 9 ], abort => 1 })
+	if $ENV{TEST_NGINX_UNSAFE};
+
 # unknown frame type
 
 $sess = new_session();
@@ -2436,10 +2441,12 @@ sub new_stream {
 	$split = ref $uri->{split} && $uri->{split} || [];
 	for (@$split) {
 		raw_write($ctx->{socket}, substr($buf, 0, $_, ""));
+		goto done if $uri->{abort};
 		select undef, undef, undef, 0.2;
 	}
 
 	raw_write($ctx->{socket}, $buf);
+done:
 	return $ctx->{last_stream};
 }