Mercurial > hg > nginx-tests
comparison h2.t @ 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 |
comparison
equal
deleted
inserted
replaced
783:dba6660b31db | 784:d51f7d5d8b4c |
---|---|
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(287); | 35 ->has_daemon('openssl')->plan(290); |
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 |
57 server { | 57 server { |
58 listen 127.0.0.1:8080 http2; | 58 listen 127.0.0.1:8080 http2; |
59 listen 127.0.0.1:8081; | 59 listen 127.0.0.1:8081; |
60 listen 127.0.0.1:8082 proxy_protocol http2; | 60 listen 127.0.0.1:8082 proxy_protocol http2; |
61 listen 127.0.0.1:8084 http2 ssl; | 61 listen 127.0.0.1:8084 http2 ssl; |
62 listen 127.0.0.1:8092 http2 sndbuf=128; | |
62 server_name localhost; | 63 server_name localhost; |
63 | 64 |
64 ssl_certificate_key localhost.key; | 65 ssl_certificate_key localhost.key; |
65 ssl_certificate localhost.crt; | 66 ssl_certificate localhost.crt; |
66 http2_max_field_size 128k; | 67 http2_max_field_size 128k; |
81 gzip on; | 82 gzip on; |
82 gzip_min_length 0; | 83 gzip_min_length 0; |
83 alias %%TESTDIR%%/t2.html; | 84 alias %%TESTDIR%%/t2.html; |
84 } | 85 } |
85 location /frame_size { | 86 location /frame_size { |
87 add_header X-LongHeader $arg_h; | |
88 add_header X-LongHeader $arg_h; | |
89 add_header X-LongHeader $arg_h; | |
86 http2_chunk_size 64k; | 90 http2_chunk_size 64k; |
87 alias %%TESTDIR%%/t1.html; | 91 alias %%TESTDIR%%/t1.html; |
88 output_buffers 2 1m; | 92 output_buffers 2 1m; |
89 } | 93 } |
90 location /continuation { | 94 location /continuation { |
1884 | 1888 |
1885 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]); | 1889 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]); |
1886 @data = grep { $_->{type} =~ "HEADERS|CONTINUATION" } @$frames; | 1890 @data = grep { $_->{type} =~ "HEADERS|CONTINUATION" } @$frames; |
1887 @data = sort { $a <=> $b } map { $_->{length} } @data; | 1891 @data = sort { $a <=> $b } map { $_->{length} } @data; |
1888 cmp_ok($data[-1], '<=', 2**14, 'response header frames limited'); | 1892 cmp_ok($data[-1], '<=', 2**14, 'response header frames limited'); |
1893 | |
1894 # response header frame sent in parts | |
1895 | |
1896 TODO: { | |
1897 local $TODO = 'not yet'; | |
1898 | |
1899 $sess = new_session(8092); | |
1900 h2_settings($sess, 0, 0x5 => 2**17); | |
1901 | |
1902 $sid = new_stream($sess, { path => '/frame_size?h=' . 'x' x 2**15 }); | |
1903 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]); | |
1904 | |
1905 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
1906 ok($frame, 'response header - parts'); | |
1907 | |
1908 SKIP: { | |
1909 skip 'response header failed', 1 unless $frame; | |
1910 | |
1911 ok(join('', @{$frame->{headers}->{'x-longheader'}}) eq 'x' x 2**15 x 3, | |
1912 'response header - headers'); | |
1913 | |
1914 } | |
1915 | |
1916 # response header block split and sent in parts | |
1917 | |
1918 $sess = new_session(8092); | |
1919 $sid = new_stream($sess, { path => '/continuation?h=' . 'x' x 2**15 }); | |
1920 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]); | |
1921 | |
1922 @data = grep { $_->{type} =~ "HEADERS|CONTINUATION" } @$frames; | |
1923 $lengths = join ' ', map { $_->{length} } @data; | |
1924 like($lengths, qr/16384 16384 16384 16384 16384 16384 \d+/, | |
1925 'response header split - parts'); | |
1926 | |
1927 } | |
1889 | 1928 |
1890 # max_field_size - header field name | 1929 # max_field_size - header field name |
1891 | 1930 |
1892 $sess = new_session(8087); | 1931 $sess = new_session(8087); |
1893 $sid = new_stream($sess, { headers => [ | 1932 $sid = new_stream($sess, { headers => [ |