comparison h2.t @ 654:a64fe1054fb4

Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 20 Aug 2015 19:20:30 +0300
parents 5ad620022234
children 75ecd26b8831
comparison
equal deleted inserted replaced
653:5ad620022234 654:a64fe1054fb4
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(147); 35 ->has_daemon('openssl')->plan(150);
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
145 server { 145 server {
146 listen 127.0.0.1:8085 http2; 146 listen 127.0.0.1:8085 http2;
147 server_name localhost2; 147 server_name localhost2;
148 return 200 second; 148 return 200 second;
149 } 149 }
150
151 server {
152 listen 127.0.0.1:8086 http2;
153 server_name localhost;
154
155 http2_max_concurrent_streams 1;
156 }
150 } 157 }
151 158
152 EOF 159 EOF
153 160
154 $t->write_file('openssl.conf', <<EOF); 161 $t->write_file('openssl.conf', <<EOF);
1305 1312
1306 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid2 } @$frames; 1313 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid2 } @$frames;
1307 is($frame->{headers}->{':status'}, 200, 'RST_STREAM 2'); 1314 is($frame->{headers}->{':status'}, 200, 'RST_STREAM 2');
1308 1315
1309 } 1316 }
1317
1318 # http2_max_concurrent_streams
1319
1320 $sess = new_session(8086);
1321 $frames = h2_read($sess, all => [{ type => 'SETTINGS' }]);
1322
1323 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames;
1324 is($frame->{3}, 1, 'http2_max_concurrent_streams SETTINGS');
1325
1326 h2_window($sess, 2**18);
1327
1328 $sid = new_stream($sess, { path => '/t1.html' });
1329 $frames = h2_read($sess, all => [{ sid => $sid, length => 2 ** 16 - 1 }]);
1330
1331 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames;
1332 is($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams');
1333
1334 $sid2 = new_stream($sess, { path => '/t1.html' });
1335 $frames = h2_read($sess);
1336
1337 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid2 } @$frames;
1338 isnt($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams 2');
1310 1339
1311 1340
1312 # some invalid cases below 1341 # some invalid cases below
1313 1342
1314 # GOAWAY on SYN_STREAM with even StreamID 1343 # GOAWAY on SYN_STREAM with even StreamID