comparison h2.t @ 740:3e2676108d69

Tests: added HTTP/2 test for queued stream cleanup.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 19 Oct 2015 17:04:25 +0300
parents 610e394a6e73
children a2e7f5ff3aa8
comparison
equal deleted inserted replaced
739:610e394a6e73 740:3e2676108d69
30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); }; 30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); };
31 plan(skip_all => 'IO::Socket::SSL too old') if $@; 31 plan(skip_all => 'IO::Socket::SSL too old') if $@;
32 32
33 my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/) 33 my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/)
34 ->has(qw/limit_conn rewrite realip shmem/) 34 ->has(qw/limit_conn rewrite realip shmem/)
35 ->has_daemon('openssl')->plan(227); 35 ->has_daemon('openssl')->plan(228);
36 36
37 # Some systems have a bug in not treating zero writev iovcnt as EINVAL 37 # Some systems have a bug in not treating zero writev iovcnt as EINVAL
38 38
39 $t->todo_alerts() if $^O eq 'darwin'; 39 $t->todo_alerts() if $^O eq 'darwin';
40 40
1356 is($frame->{headers}->{':status'}, 200, 'large response - HEADERS'); 1356 is($frame->{headers}->{':status'}, 200, 'large response - HEADERS');
1357 1357
1358 @data = grep { $_->{type} eq "DATA" } @$frames; 1358 @data = grep { $_->{type} eq "DATA" } @$frames;
1359 $sum = eval join '+', map { $_->{length} } @data; 1359 $sum = eval join '+', map { $_->{length} } @data;
1360 is($sum, 5000000, 'large response - DATA'); 1360 is($sum, 5000000, 'large response - DATA');
1361
1362 # stream with large response queued on write - RST_STREAM handling
1363
1364 $sess = new_session();
1365 $sid = new_stream($sess, { path => '/tbig.html' });
1366
1367 h2_window($sess, 2**30, $sid);
1368 h2_window($sess, 2**30);
1369
1370 select undef, undef, undef, 0.4;
1371
1372 h2_rst($sess, $sid, 8);
1373 h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
1374
1375 $sid = new_stream($sess);
1376 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
1377
1378 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
1379 is($frame->{sid}, 3, 'large response - queued with RST_STREAM');
1361 1380
1362 # SETTINGS_MAX_FRAME_SIZE 1381 # SETTINGS_MAX_FRAME_SIZE
1363 1382
1364 $sess = new_session(); 1383 $sess = new_session();
1365 $sid = new_stream($sess, { path => '/frame_size' }); 1384 $sid = new_stream($sess, { path => '/frame_size' });