# HG changeset patch # User Sergey Kandaurov # Date 1445980303 -10800 # Node ID bb4486e173abc23c50feb24ad9c6d3ce4a13c624 # Parent f95aa716624eca91d384728fc127d0c116748f6e Tests: HTTP/2 tests for streams depending on itself. diff --git a/h2.t b/h2.t --- a/h2.t +++ b/h2.t @@ -32,7 +32,7 @@ plan(skip_all => 'IO::Socket::SSL too ol my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/) ->has(qw/limit_conn rewrite realip shmem/) - ->has_daemon('openssl')->plan(233); + ->has_daemon('openssl')->plan(237); # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL @@ -1883,6 +1883,23 @@ h2_window($sess, 2**17); $sids = join ' ', map { $_->{sid} } @data; is($sids, "$sid $sid2", 'dependency - PRIORITY 2'); +# PRIORITY - self dependency + +# 5.3.1. Stream Dependencies +# A stream cannot depend on itself. An endpoint MUST treat this as a +# stream error of type PROTOCOL_ERROR. + +$sess = new_session(); +$sid = new_stream($sess); +h2_read($sess, all => [{ sid => $sid, fin => 1 }]); + +h2_priority($sess, 0, $sid, $sid); +$frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]); + +($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; +is($frame->{sid}, $sid, 'dependency - PRIORITY self - RST_STREAM'); +is($frame->{code}, 1, 'dependency - PRIORITY self - PROTOCOL_ERROR'); + # HEADERS PRIORITY flag, reprioritize prior PRIORITY frame records $sess = new_session(); @@ -1935,6 +1952,21 @@ h2_window($sess, 2**17); $sids = join ' ', map { $_->{sid} } @data; is($sids, "$sid $sid2", 'dependency - HEADERS PRIORITY 2'); +# HEADERS - self dependency + +SKIP: { +skip 'leaves coredump', 2 unless $ENV{TEST_NGINX_UNSAFE}; + +$sess = new_session(); +$sid = new_stream($sess, { dep => 1 }); +$frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]); + +($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; +is($frame->{sid}, $sid, 'dependency - HEADERS self - RST_STREAM'); +is($frame->{code}, 1, 'dependency - HEADERS self - PROTOCOL_ERROR'); + +} + # PRIORITY frame, weighted dependencies $sess = new_session();