# HG changeset patch # User Sergey Kandaurov # Date 1454689761 -10800 # Node ID 40ad07634a5e3880426c9d22b672a3e01a9a6b45 # Parent 7de036e897707431bae0f89c78a812067cdd2823 Tests: added HTTP/2 test for huffman encoding. diff --git a/h2.t b/h2.t --- 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(308); + ->has_daemon('openssl')->plan(310); # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL @@ -746,6 +746,21 @@ is($frame->{headers}->{'x-sent-foo'}, 'X is($frame->{headers}->{'x-sent-foo'}, 'X-Baz', 'name with indexing - indexed name'); +# header field with characters not suitable for huffman encoding + +$sess = new_session(); +$sid = new_stream($sess, { headers => [ + { name => ':method', value => 'GET', mode => 0 }, + { name => ':scheme', value => 'http', mode => 0 }, + { name => ':path', value => '/', mode => 0 }, + { name => ':authority', value => 'localhost', mode => 1 }, + { name => 'x-foo', value => '{{{{{', mode => 2 }]}); +$frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); + +($frame) = grep { $_->{type} eq "HEADERS" } @$frames; +is($frame->{headers}->{'x-sent-foo'}, '{{{{{', 'rare chars'); +like($sess->{headers}, qr/\Q{{{{{/, 'rare chars - no huffman encoding'); + # 6.3. Dynamic Table Size Update # remove some indexed headers from the dynamic table