Mercurial > hg > nginx-tests
comparison h2.t @ 757:9187c6902b30
Tests: HTTP/2 circular stream dependency after removed dependency.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 28 Oct 2015 00:11:43 +0300 |
parents | bb4486e173ab |
children | 70c486d09663 |
comparison
equal
deleted
inserted
replaced
756:bb4486e173ab | 757:9187c6902b30 |
---|---|
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(237); | 35 ->has_daemon('openssl')->plan(240); |
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 |
2028 ]); | 2028 ]); |
2029 | 2029 |
2030 @data = grep { $_->{type} eq "DATA" } @$frames; | 2030 @data = grep { $_->{type} eq "DATA" } @$frames; |
2031 $sids = join ' ', map { $_->{sid} } @data; | 2031 $sids = join ' ', map { $_->{sid} } @data; |
2032 is($sids, "$sid3 $sid2 $sid", 'weighted dependency - PRIORITY 2'); | 2032 is($sids, "$sid3 $sid2 $sid", 'weighted dependency - PRIORITY 2'); |
2033 | |
2034 # PRIORITY - reprioritization with circular dependency - after [3] removed | |
2035 # initial dependency tree: | |
2036 # 1 <- [3] <- 5 | |
2037 | |
2038 SKIP: { | |
2039 skip 'leaves codedump', 3 unless $ENV{TEST_NGINX_UNSAFE}; | |
2040 | |
2041 $sess = new_session(); | |
2042 | |
2043 h2_window($sess, 2**18); | |
2044 | |
2045 h2_priority($sess, 16, 1, 0); | |
2046 h2_priority($sess, 16, 3, 1); | |
2047 h2_priority($sess, 16, 5, 3); | |
2048 | |
2049 $sid = new_stream($sess, { path => '/t1.html' }); | |
2050 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]); | |
2051 | |
2052 $sid2 = new_stream($sess, { path => '/t1.html' }); | |
2053 h2_read($sess, all => [{ sid => $sid2, length => 2**16 - 1 }]); | |
2054 | |
2055 $sid3 = new_stream($sess, { path => '/t1.html' }); | |
2056 h2_read($sess, all => [{ sid => $sid3, length => 2**16 - 1 }]); | |
2057 | |
2058 h2_window($sess, 2**16, $sid2); | |
2059 | |
2060 $frames = h2_read($sess, all => [{ sid => $sid2, fin => 1 }]); | |
2061 $sids = join ' ', map { $_->{sid} } grep { $_->{type} eq "DATA" } @$frames; | |
2062 is($sids, $sid2, 'removed dependency'); | |
2063 | |
2064 for (1 .. 40) { | |
2065 h2_read($sess, all => [{ sid => new_stream($sess), fin => 1 }]); | |
2066 } | |
2067 | |
2068 # make circular dependency | |
2069 # 1 <- 5 -- current dependency tree before reprioritization | |
2070 # 5 <- 1 | |
2071 # 1 <- 5 | |
2072 | |
2073 h2_priority($sess, 16, 1, 5); | |
2074 h2_priority($sess, 16, 5, 1); | |
2075 | |
2076 h2_window($sess, 2**16, $sid); | |
2077 h2_window($sess, 2**16, $sid3); | |
2078 | |
2079 $frames = h2_read($sess, all => [ | |
2080 { sid => $sid, fin => 1 }, | |
2081 { sid => $sid3, fin => 1 }, | |
2082 ]); | |
2083 | |
2084 ($frame) = grep { $_->{type} eq "DATA" && $_->{sid} == $sid } @$frames; | |
2085 is($frame->{length}, 81, 'removed dependency - first stream'); | |
2086 | |
2087 ($frame) = grep { $_->{type} eq "DATA" && $_->{sid} == $sid3 } @$frames; | |
2088 is($frame->{length}, 81, 'removed dependency - last stream'); | |
2089 | |
2090 } | |
2033 | 2091 |
2034 # limit_conn | 2092 # limit_conn |
2035 | 2093 |
2036 $sess = new_session(); | 2094 $sess = new_session(); |
2037 h2_settings($sess, 0, 0x4 => 1); | 2095 h2_settings($sess, 0, 0x4 => 1); |