# HG changeset patch # User Sergey Kandaurov # Date 1454926922 -10800 # Node ID cebd29c253ea720e9a2eeae1de827fb6587ea8a5 # Parent 40ad07634a5e3880426c9d22b672a3e01a9a6b45 Tests: added HTTP/2 positive 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(310); + ->has_daemon('openssl')->plan(312); # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL @@ -746,7 +746,7 @@ 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 +# response header field with characters not suitable for huffman encoding $sess = new_session(); $sid = new_stream($sess, { headers => [ @@ -761,6 +761,28 @@ is($frame->{headers}->{'x-sent-foo'}, 'X is($frame->{headers}->{'x-sent-foo'}, '{{{{{', 'rare chars'); like($sess->{headers}, qr/\Q{{{{{/, 'rare chars - no huffman encoding'); +# response header field with huffman encoding +# NB: implementation detail, not obligated + +$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 => 'aaaaa', mode => 2 }]}); +$frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); + +($frame) = grep { $_->{type} eq "HEADERS" } @$frames; +is($frame->{headers}->{'x-sent-foo'}, 'aaaaa', 'well known chars'); + +TODO: { +local $TODO = 'not yet'; + +unlike($sess->{headers}, qr/aaaaa/, 'well known chars - huffman encoding'); + +} + # 6.3. Dynamic Table Size Update # remove some indexed headers from the dynamic table