comparison h2.t @ 729:41caaaff9b95

Tests: added HTTP/2 tests for invalid table size update.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 01 Oct 2015 19:24:00 +0300
parents 61800918f647
children 63c45a158cde
comparison
equal deleted inserted replaced
728:61800918f647 729:41caaaff9b95
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(216); 35 ->has_daemon('openssl')->plan(219);
36 36
37 # FreeBSD has a bug in not treating zero iovcnt as EINVAL 37 # FreeBSD has a bug in not treating zero iovcnt as EINVAL
38 38
39 $t->todo_alerts() unless $^O eq 'freebsd'; 39 $t->todo_alerts() unless $^O eq 'freebsd';
40 40
600 # A decoding error in a header block MUST be treated 600 # A decoding error in a header block MUST be treated
601 # as a connection error of type COMPRESSION_ERROR. 601 # as a connection error of type COMPRESSION_ERROR.
602 602
603 is($frame->{last_sid}, $sid, 'invalid index - GOAWAY last stream'); 603 is($frame->{last_sid}, $sid, 'invalid index - GOAWAY last stream');
604 is($frame->{code}, 9, 'invalid index - GOAWAY COMPRESSION_ERROR'); 604 is($frame->{code}, 9, 'invalid index - GOAWAY COMPRESSION_ERROR');
605
606 # invalid table size update
607
608 $sess = new_session();
609 $sid = new_stream($sess, { table_size => 4097, headers => [
610 { name => ':method', value => 'GET', mode => 0 },
611 { name => ':scheme', value => 'http', mode => 0 },
612 { name => ':path', value => '/', mode => 0 },
613 { name => 'x-foo', value => 'X-Bar', mode => 0 },
614 { name => ':authority', value => 'localhost', mode => 1 }]});
615 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
616
617 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
618 ok($frame, 'invalid table size - GOAWAY');
619 is($frame->{last_sid}, $sid, 'invalid table size - GOAWAY last stream');
620 is($frame->{code}, 9, 'invalid table size - GOAWAY COMPRESSION_ERROR');
605 621
606 # HEAD 622 # HEAD
607 623
608 $sess = new_session(); 624 $sess = new_session();
609 $sid = new_stream($sess, { method => 'HEAD' }); 625 $sid = new_stream($sess, { method => 'HEAD' });