Mercurial > hg > nginx-tests
comparison h2.t @ 871:f693b0aea20f
Tests: added HTTP/2 test for request body sent in separate frames.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 16 Mar 2016 18:19:33 +0300 |
parents | 89898b20f258 |
children | a6abbfed42c0 |
comparison
equal
deleted
inserted
replaced
870:56994b4ce142 | 871:f693b0aea20f |
---|---|
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(318); | 35 ->has_daemon('openssl')->plan(319); |
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 |
1520 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 1520 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); |
1521 | 1521 |
1522 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 1522 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
1523 is($frame->{headers}->{':status'}, '200', 'request body with padding - next'); | 1523 is($frame->{headers}->{':status'}, '200', 'request body with padding - next'); |
1524 | 1524 |
1525 # request body sent in multiple DATA frames (uses proxied response) | 1525 # request body sent in multiple DATA frames in a single packet |
1526 | 1526 |
1527 $sess = new_session(); | 1527 $sess = new_session(); |
1528 $sid = new_stream($sess, { path => '/proxy2/t2.html', body_more => 1 }); | 1528 $sid = new_stream($sess, { path => '/proxy2/t2.html', body_more => 1 }); |
1529 h2_body($sess, 'TEST', { body_split => [2] }); | 1529 h2_body($sess, 'TEST', { body_split => [2] }); |
1530 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 1530 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); |
1531 | 1531 |
1532 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 1532 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
1533 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST', | 1533 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST', |
1534 'request body in multiple frames'); | 1534 'request body in multiple frames'); |
1535 | |
1536 # request body sent in multiple DATA frames, each in its own packet | |
1537 | |
1538 $sess = new_session(); | |
1539 $sid = new_stream($sess, { path => '/proxy2/t2.html', body_more => 1 }); | |
1540 h2_body($sess, 'TEST', { body_more => 1 }); | |
1541 select undef, undef, undef, 0.1; | |
1542 h2_body($sess, 'MOREDATA'); | |
1543 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | |
1544 | |
1545 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
1546 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTMOREDATA', | |
1547 'request body in multiple frames separately'); | |
1535 | 1548 |
1536 # request body with an empty DATA frame | 1549 # request body with an empty DATA frame |
1537 # "zero size buf in output" alerts seen | 1550 # "zero size buf in output" alerts seen |
1538 | 1551 |
1539 $sess = new_session(); | 1552 $sess = new_session(); |