Mercurial > hg > nginx-tests
comparison h2.t @ 739:610e394a6e73
Tests: HTTP/2 tests for HPACK zero index.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 19 Oct 2015 17:03:23 +0300 |
parents | 0881219c0699 |
children | 3e2676108d69 |
comparison
equal
deleted
inserted
replaced
738:0881219c0699 | 739:610e394a6e73 |
---|---|
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(225); | 35 ->has_daemon('openssl')->plan(227); |
36 | 36 |
37 # Some systems have a bug in not treating zero writev iovcnt as EINVAL | 37 # Some systems have a bug in not treating zero writev iovcnt as EINVAL |
38 | 38 |
39 $t->todo_alerts() if $^O eq 'darwin'; | 39 $t->todo_alerts() if $^O eq 'darwin'; |
40 | 40 |
643 # A decoding error in a header block MUST be treated | 643 # A decoding error in a header block MUST be treated |
644 # as a connection error of type COMPRESSION_ERROR. | 644 # as a connection error of type COMPRESSION_ERROR. |
645 | 645 |
646 is($frame->{last_sid}, $sid, 'invalid index - GOAWAY last stream'); | 646 is($frame->{last_sid}, $sid, 'invalid index - GOAWAY last stream'); |
647 is($frame->{code}, 9, 'invalid index - GOAWAY COMPRESSION_ERROR'); | 647 is($frame->{code}, 9, 'invalid index - GOAWAY COMPRESSION_ERROR'); |
648 | |
649 # HPACK zero index | |
650 | |
651 # RFC 7541, 6.1 Indexed Header Field Representation | |
652 # The index value of 0 is not used. It MUST be treated as a decoding | |
653 # error if found in an indexed header field representation. | |
654 | |
655 $sess = new_session(); | |
656 $sid = new_stream($sess, { headers => [ | |
657 { name => ':method', value => 'GET', mode => 0 }, | |
658 { name => ':scheme', value => 'http', mode => 0 }, | |
659 { name => ':path', value => '/', mode => 0 }, | |
660 { name => ':authority', value => 'localhost', mode => 1 }, | |
661 { name => '', value => '', mode => 0 }]}); | |
662 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | |
663 | |
664 ok($frame, 'zero index - GOAWAY'); | |
665 is($frame->{code}, 9, 'zero index - GOAWAY COMPRESSION_ERROR'); | |
648 | 666 |
649 # invalid table size update | 667 # invalid table size update |
650 | 668 |
651 $sess = new_session(); | 669 $sess = new_session(); |
652 $sid = new_stream($sess, { table_size => 4097, headers => [ | 670 $sid = new_stream($sess, { table_size => 4097, headers => [ |