comparison h2.t @ 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 b818ea3a73de
children f95aa716624e
comparison
equal deleted inserted replaced
753:63d1b7cb974a 754:84a52b6d6343
2245 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); 2245 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
2246 2246
2247 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 2247 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
2248 is($frame->{headers}->{':status'}, 400, 'empty authority'); 2248 is($frame->{headers}->{':status'}, 400, 'empty authority');
2249 2249
2250 # aborted stream with zero HEADERS payload followed by client connection close
2251
2252 new_stream(new_session(), { split => [ 9 ], abort => 1 })
2253 if $ENV{TEST_NGINX_UNSAFE};
2254
2250 # unknown frame type 2255 # unknown frame type
2251 2256
2252 $sess = new_session(); 2257 $sess = new_session();
2253 h2_unknown($sess, 'payload'); 2258 h2_unknown($sess, 'payload');
2254 h2_ping($sess, 'SEE-THIS'); 2259 h2_ping($sess, 'SEE-THIS');
2434 } 2439 }
2435 2440
2436 $split = ref $uri->{split} && $uri->{split} || []; 2441 $split = ref $uri->{split} && $uri->{split} || [];
2437 for (@$split) { 2442 for (@$split) {
2438 raw_write($ctx->{socket}, substr($buf, 0, $_, "")); 2443 raw_write($ctx->{socket}, substr($buf, 0, $_, ""));
2444 goto done if $uri->{abort};
2439 select undef, undef, undef, 0.2; 2445 select undef, undef, undef, 0.2;
2440 } 2446 }
2441 2447
2442 raw_write($ctx->{socket}, $buf); 2448 raw_write($ctx->{socket}, $buf);
2449 done:
2443 return $ctx->{last_stream}; 2450 return $ctx->{last_stream};
2444 } 2451 }
2445 2452
2446 sub h2_read { 2453 sub h2_read {
2447 my ($sess, %extra) = @_; 2454 my ($sess, %extra) = @_;