comparison h2.t @ 763:2ba4058848d6

Tests: HTTP/2 test for write event timeout.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 28 Oct 2015 00:11:45 +0300
parents f28debc81182
children 5dcd998daace
comparison
equal deleted inserted replaced
762:f28debc81182 763:2ba4058848d6
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(275); 35 ->has_daemon('openssl')->plan(276);
36 36
37 # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL 37 # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL
38 38
39 $t->todo_alerts(); 39 $t->todo_alerts();
40 40
222 location /proxy2/ { 222 location /proxy2/ {
223 add_header X-Body "$request_body"; 223 add_header X-Body "$request_body";
224 proxy_pass http://127.0.0.1:8081/; 224 proxy_pass http://127.0.0.1:8081/;
225 } 225 }
226 } 226 }
227
228 server {
229 listen 127.0.0.1:8091 http2;
230 server_name localhost;
231
232 send_timeout 1s;
233 }
227 } 234 }
228 235
229 EOF 236 EOF
230 237
231 $t->write_file('openssl.conf', <<EOF); 238 $t->write_file('openssl.conf', <<EOF);
1701 is($frame->{headers}->{':status'}, 200, 'large response - HEADERS'); 1708 is($frame->{headers}->{':status'}, 200, 'large response - HEADERS');
1702 1709
1703 @data = grep { $_->{type} eq "DATA" } @$frames; 1710 @data = grep { $_->{type} eq "DATA" } @$frames;
1704 $sum = eval join '+', map { $_->{length} } @data; 1711 $sum = eval join '+', map { $_->{length} } @data;
1705 is($sum, 5000000, 'large response - DATA'); 1712 is($sum, 5000000, 'large response - DATA');
1713
1714 # write event send timeout
1715
1716 $sess = new_session(8091);
1717 $sid = new_stream($sess, { path => '/tbig.html' });
1718 h2_window($sess, 2**30, $sid);
1719 h2_window($sess, 2**30);
1720
1721 select undef, undef, undef, 2.1;
1722
1723 h2_ping($sess, 'SEE-THIS');
1724
1725 $frames = h2_read($sess, all => [{ type => 'PING' }]);
1726 ok(!grep ({ $_->{type} eq "PING" } @$frames), 'large response - send timeout');
1706 1727
1707 # stream with large response queued on write - RST_STREAM handling 1728 # stream with large response queued on write - RST_STREAM handling
1708 1729
1709 $sess = new_session(); 1730 $sess = new_session();
1710 $sid = new_stream($sess, { path => '/tbig.html' }); 1731 $sid = new_stream($sess, { path => '/tbig.html' });