comparison h2.t @ 756:bb4486e173ab

Tests: HTTP/2 tests for streams depending on itself.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 28 Oct 2015 00:11:43 +0300
parents f95aa716624e
children 9187c6902b30
comparison
equal deleted inserted replaced
755:f95aa716624e 756:bb4486e173ab
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(233); 35 ->has_daemon('openssl')->plan(237);
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
1881 1881
1882 @data = grep { $_->{type} eq "DATA" } @$frames; 1882 @data = grep { $_->{type} eq "DATA" } @$frames;
1883 $sids = join ' ', map { $_->{sid} } @data; 1883 $sids = join ' ', map { $_->{sid} } @data;
1884 is($sids, "$sid $sid2", 'dependency - PRIORITY 2'); 1884 is($sids, "$sid $sid2", 'dependency - PRIORITY 2');
1885 1885
1886 # PRIORITY - self dependency
1887
1888 # 5.3.1. Stream Dependencies
1889 # A stream cannot depend on itself. An endpoint MUST treat this as a
1890 # stream error of type PROTOCOL_ERROR.
1891
1892 $sess = new_session();
1893 $sid = new_stream($sess);
1894 h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
1895
1896 h2_priority($sess, 0, $sid, $sid);
1897 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
1898
1899 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames;
1900 is($frame->{sid}, $sid, 'dependency - PRIORITY self - RST_STREAM');
1901 is($frame->{code}, 1, 'dependency - PRIORITY self - PROTOCOL_ERROR');
1902
1886 # HEADERS PRIORITY flag, reprioritize prior PRIORITY frame records 1903 # HEADERS PRIORITY flag, reprioritize prior PRIORITY frame records
1887 1904
1888 $sess = new_session(); 1905 $sess = new_session();
1889 1906
1890 h2_priority($sess, 16, 1, 0); 1907 h2_priority($sess, 16, 1, 0);
1932 ]); 1949 ]);
1933 1950
1934 @data = grep { $_->{type} eq "DATA" } @$frames; 1951 @data = grep { $_->{type} eq "DATA" } @$frames;
1935 $sids = join ' ', map { $_->{sid} } @data; 1952 $sids = join ' ', map { $_->{sid} } @data;
1936 is($sids, "$sid $sid2", 'dependency - HEADERS PRIORITY 2'); 1953 is($sids, "$sid $sid2", 'dependency - HEADERS PRIORITY 2');
1954
1955 # HEADERS - self dependency
1956
1957 SKIP: {
1958 skip 'leaves coredump', 2 unless $ENV{TEST_NGINX_UNSAFE};
1959
1960 $sess = new_session();
1961 $sid = new_stream($sess, { dep => 1 });
1962 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
1963
1964 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames;
1965 is($frame->{sid}, $sid, 'dependency - HEADERS self - RST_STREAM');
1966 is($frame->{code}, 1, 'dependency - HEADERS self - PROTOCOL_ERROR');
1967
1968 }
1937 1969
1938 # PRIORITY frame, weighted dependencies 1970 # PRIORITY frame, weighted dependencies
1939 1971
1940 $sess = new_session(); 1972 $sess = new_session();
1941 1973