Mercurial > hg > nginx-tests
changeset 784:d51f7d5d8b4c
Tests: added HTTP/2 tests for response header sent in parts.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Sat, 14 Nov 2015 00:01:55 +0300 |
parents | dba6660b31db |
children | 91e23e0c923a |
files | h2.t |
diffstat | 1 files changed, 40 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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(287); + ->has_daemon('openssl')->plan(290); # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL @@ -59,6 +59,7 @@ http { listen 127.0.0.1:8081; listen 127.0.0.1:8082 proxy_protocol http2; listen 127.0.0.1:8084 http2 ssl; + listen 127.0.0.1:8092 http2 sndbuf=128; server_name localhost; ssl_certificate_key localhost.key; @@ -83,6 +84,9 @@ http { alias %%TESTDIR%%/t2.html; } location /frame_size { + add_header X-LongHeader $arg_h; + add_header X-LongHeader $arg_h; + add_header X-LongHeader $arg_h; http2_chunk_size 64k; alias %%TESTDIR%%/t1.html; output_buffers 2 1m; @@ -1887,6 +1891,41 @@ cmp_ok($data[-1], '<=', 2**14, 'no body @data = sort { $a <=> $b } map { $_->{length} } @data; cmp_ok($data[-1], '<=', 2**14, 'response header frames limited'); +# response header frame sent in parts + +TODO: { +local $TODO = 'not yet'; + +$sess = new_session(8092); +h2_settings($sess, 0, 0x5 => 2**17); + +$sid = new_stream($sess, { path => '/frame_size?h=' . 'x' x 2**15 }); +$frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]); + +($frame) = grep { $_->{type} eq "HEADERS" } @$frames; +ok($frame, 'response header - parts'); + +SKIP: { +skip 'response header failed', 1 unless $frame; + +ok(join('', @{$frame->{headers}->{'x-longheader'}}) eq 'x' x 2**15 x 3, + 'response header - headers'); + +} + +# response header block split and sent in parts + +$sess = new_session(8092); +$sid = new_stream($sess, { path => '/continuation?h=' . 'x' x 2**15 }); +$frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]); + +@data = grep { $_->{type} =~ "HEADERS|CONTINUATION" } @$frames; +$lengths = join ' ', map { $_->{length} } @data; +like($lengths, qr/16384 16384 16384 16384 16384 16384 \d+/, + 'response header split - parts'); + +} + # max_field_size - header field name $sess = new_session(8087);