Mercurial > hg > nginx-tests
changeset 697:46f698a7e59c
Tests: added HTTP/2 test for unknown frame type.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 15 Sep 2015 18:40:33 +0300 |
parents | beab9da9b731 |
children | f86c8314d205 |
files | h2.t |
diffstat | 1 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/h2.t +++ b/h2.t @@ -32,7 +32,7 @@ plan(skip_all => 'IO::Socket::SSL too ol my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/) ->has(qw/limit_conn rewrite realip shmem/) - ->has_daemon('openssl')->plan(193); + ->has_daemon('openssl')->plan(194); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -1712,6 +1712,16 @@ is($frame->{headers}->{':status'}, 400, ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; is($frame->{headers}->{':status'}, 400, 'empty authority'); +# unknown frame type + +$sess = new_session(); +h2_unknown($sess, 'payload'); +h2_ping($sess, 'SEE-THIS'); +$frames = h2_read($sess, all => [{ type => 'PING' }]); + +($frame) = grep { $_->{type} eq "PING" } @$frames; +is($frame->{value}, 'SEE-THIS', 'unknown frame type'); + # GOAWAY - force closing a connection by server $sid = new_stream($sess, { path => 't1.html' }); @@ -1762,6 +1772,13 @@ sub h2_settings { raw_write($sess->{socket}, $buf); } +sub h2_unknown { + my ($sess, $payload) = @_; + + my $buf = pack_length(length($payload)) . pack("Cx5a*", 0xa, $payload); + raw_write($sess->{socket}, $buf); +} + sub h2_continue { my ($ctx, $stream, $uri) = @_;