Mercurial > hg > nginx-tests
diff spdy.t @ 704:626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 22 Sep 2015 15:38:16 +0300 |
parents | 2b43ad56bce0 |
children | 63c45a158cde |
line wrap: on
line diff
--- a/spdy.t +++ b/spdy.t @@ -37,7 +37,11 @@ plan(skip_all => 'Compress::Raw::Zlib no my $t = Test::Nginx->new() ->has(qw/http proxy cache limit_conn rewrite spdy realip shmem/); -$t->plan(82)->write_file_expand('nginx.conf', <<'EOF'); +# FreeBSD has a bug in not treating zero iovcnt as EINVAL + +$t->todo_alerts() unless $^O eq 'freebsd'; + +$t->plan(84)->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -121,6 +125,8 @@ EOF $t->write_file('t1.html', join('', map { sprintf "X%04dXXX", $_ } (1 .. 8202))); +$t->write_file('tbig.html', + join('', map { sprintf "XX%06dXX", $_ } (1 .. 100000))); $t->write_file('t2.html', 'SEE-THIS'); $t->write_file('t3.html', 'SEE-THIS'); @@ -426,6 +432,23 @@ spdy_window($sess, 1, $sid1); is(@$frames, 1, 'positive window - data'); is(@$frames[0]->{length}, 1, 'positive window - data length'); +# ask write handler in sending large response + +$sid1 = spdy_stream($sess, { path => '/tbig.html' }); + +spdy_window($sess, 2**30, $sid1); +spdy_window($sess, 2**30); + +sleep 1; +$frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); + +($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; +is($frame->{headers}->{':status'}, 200, 'large response - HEADERS'); + +@data = grep { $_->{type} eq "DATA" } @$frames; +$sum = eval join '+', map { $_->{length} } @data; +is($sum, 1000000, 'large response - DATA'); + # stream multiplexing $sess = new_session();