comparison h2.t @ 848:40ad07634a5e

Tests: added HTTP/2 test for huffman encoding.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 05 Feb 2016 19:29:21 +0300
parents 7de036e89770
children cebd29c253ea
comparison
equal deleted inserted replaced
847:7de036e89770 848:40ad07634a5e
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(308); 35 ->has_daemon('openssl')->plan(310);
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
743 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); 743 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
744 744
745 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 745 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
746 is($frame->{headers}->{'x-sent-foo'}, 'X-Baz', 746 is($frame->{headers}->{'x-sent-foo'}, 'X-Baz',
747 'name with indexing - indexed name'); 747 'name with indexing - indexed name');
748
749 # header field with characters not suitable for huffman encoding
750
751 $sess = new_session();
752 $sid = new_stream($sess, { headers => [
753 { name => ':method', value => 'GET', mode => 0 },
754 { name => ':scheme', value => 'http', mode => 0 },
755 { name => ':path', value => '/', mode => 0 },
756 { name => ':authority', value => 'localhost', mode => 1 },
757 { name => 'x-foo', value => '{{{{{', mode => 2 }]});
758 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
759
760 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
761 is($frame->{headers}->{'x-sent-foo'}, '{{{{{', 'rare chars');
762 like($sess->{headers}, qr/\Q{{{{{/, 'rare chars - no huffman encoding');
748 763
749 # 6.3. Dynamic Table Size Update 764 # 6.3. Dynamic Table Size Update
750 765
751 # remove some indexed headers from the dynamic table 766 # remove some indexed headers from the dynamic table
752 # by maintaining dynamic table space only for index 0 767 # by maintaining dynamic table space only for index 0