comparison h2.t @ 698:f86c8314d205

Tests: one more HTTP/2 test for max frame size. Ensure that CONTINUATION frame size is limited.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 15 Sep 2015 18:44:09 +0300
parents 46f698a7e59c
children 5768830f01c4
comparison
equal deleted inserted replaced
697:46f698a7e59c 698:f86c8314d205
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(194); 35 ->has_daemon('openssl')->plan(195);
36 36
37 $t->write_file_expand('nginx.conf', <<'EOF'); 37 $t->write_file_expand('nginx.conf', <<'EOF');
38 38
39 %%TEST_GLOBALS%% 39 %%TEST_GLOBALS%%
40 40
58 server_name localhost; 58 server_name localhost;
59 59
60 ssl_certificate_key localhost.key; 60 ssl_certificate_key localhost.key;
61 ssl_certificate localhost.crt; 61 ssl_certificate localhost.crt;
62 http2_max_field_size 128k; 62 http2_max_field_size 128k;
63 http2_max_header_size 128k;
63 64
64 location / { 65 location / {
65 add_header X-Header X-Foo; 66 add_header X-Header X-Foo;
66 add_header X-Sent-Foo $http_x_foo; 67 add_header X-Sent-Foo $http_x_foo;
67 add_header X-Referer $http_referer; 68 add_header X-Referer $http_referer;
1129 is($data[0]->{flags}, 1, 'no body CONTINUATION - first flags'); 1130 is($data[0]->{flags}, 1, 'no body CONTINUATION - first flags');
1130 is($data[1]->{type}, 'CONTINUATION', 'no body CONTINUATION - second'); 1131 is($data[1]->{type}, 'CONTINUATION', 'no body CONTINUATION - second');
1131 is($data[1]->{flags}, 0, 'no body CONTINUATION - second flags'); 1132 is($data[1]->{flags}, 0, 'no body CONTINUATION - second flags');
1132 is($data[2]->{type}, 'CONTINUATION', 'no body CONTINUATION - third'); 1133 is($data[2]->{type}, 'CONTINUATION', 'no body CONTINUATION - third');
1133 is($data[2]->{flags}, 4, 'no body CONTINUATION - third flags'); 1134 is($data[2]->{flags}, 4, 'no body CONTINUATION - third flags');
1135
1136 # response header block is always split by SETTINGS_MAX_FRAME_SIZE
1137
1138 TODO: {
1139 local $TODO = 'not yet';
1140
1141 $sess = new_session();
1142 $sid = new_stream($sess, { path => '/continuation?h=' . 'x' x 2**14 });
1143
1144 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]);
1145 @data = grep { $_->{type} =~ "HEADERS|CONTINUATION" } @$frames;
1146 @data = sort { $a <=> $b } map { $_->{length} } @data;
1147 cmp_ok($data[-1], '<=', 2**14, 'response header frames limited');
1148
1149 }
1134 1150
1135 # max_field_size 1151 # max_field_size
1136 1152
1137 $sess = new_session(8087); 1153 $sess = new_session(8087);
1138 $sid = new_stream($sess, { headers => [ 1154 $sid = new_stream($sess, { headers => [