Mercurial > hg > nginx-tests
comparison h2.t @ 667:0247e314e991
Tests: more HTTP/2 error handling tests.
Detect RST_STREAM when http2_max_concurrent_streams exceeded.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 01 Sep 2015 14:54:22 +0300 |
parents | 07de3d202eb7 |
children | 1f34870e9538 |
comparison
equal
deleted
inserted
replaced
666:64f22e0aaab2 | 667:0247e314e991 |
---|---|
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(155); | 35 ->has_daemon('openssl')->plan(159); |
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 |
1396 | 1396 |
1397 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames; | 1397 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames; |
1398 is($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams'); | 1398 is($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams'); |
1399 | 1399 |
1400 $sid2 = new_stream($sess, { path => '/t1.html' }); | 1400 $sid2 = new_stream($sess, { path => '/t1.html' }); |
1401 $frames = h2_read($sess); | 1401 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]); |
1402 | 1402 |
1403 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid2 } @$frames; | 1403 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid2 } @$frames; |
1404 isnt($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams 2'); | 1404 isnt($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams 2'); |
1405 | |
1406 TODO: { | |
1407 local $TODO = 'not yet'; | |
1408 | |
1409 ($frame) = grep { $_->{type} eq "RST_STREAM" && $_->{sid} == $sid2 } @$frames; | |
1410 is($frame->{sid}, $sid2, 'http2_max_concurrent_streams RST_STREAM sid'); | |
1411 is($frame->{length}, 4, 'http2_max_concurrent_streams RST_STREAM length'); | |
1412 is($frame->{flags}, 0, 'http2_max_concurrent_streams RST_STREAM flags'); | |
1413 is($frame->{code}, 7, 'http2_max_concurrent_streams RST_STREAM code'); | |
1414 | |
1415 } | |
1405 | 1416 |
1406 h2_window($sess, 2**16, $sid); | 1417 h2_window($sess, 2**16, $sid); |
1407 h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 1418 h2_read($sess, all => [{ sid => $sid, fin => 1 }]); |
1408 | 1419 |
1409 $sid = new_stream($sess, { path => '/t2.html' }); | 1420 $sid = new_stream($sess, { path => '/t2.html' }); |