annotate h2_priority.t @ 1571:1b4ceab9cb1c

Tests: fixed ssl_certificate.t with LibreSSL client. Net::SSLeay::connect() that manages TLS handshake could return unexpected error when receiving server alert, as seen in server certificate tests if it could not been selected. Typically, it returns the expected error -1, but with certain libssl implementations it can be 0, as explained below. The error is propagated from libssl's SSL_connect(), which is usually -1. In modern OpenSSL versions, it is the default error code used in the state machine returned when something went wrong with parsing TLS message header. In versions up to OpenSSL 1.0.2, with SSLv23_method() used by default, -1 is the only error code in the ssl_connect() method implementation which is used as well if receiving alert while parsing ServerHello. BoringSSL also seems to return -1. But it is not so with LibreSSL that returns zero. Previously, tests failed with client built with LibreSSL with SSLv3 removed. Here, the error is propagated directly from ssl_read_bytes() method, which is always implemented as ssl3_read_bytes() in all TLS methods. It could be also seen with OpenSSL up to 1.0.2 with non-default methods explicitly set.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 29 May 2020 23:10:20 +0300
parents 48306d8a2811
children 5ac6efbe5552
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
1 #!/usr/bin/perl
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
2
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
3 # (C) Sergey Kandaurov
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
4 # (C) Nginx, Inc.
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
5
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
6 # Tests for HTTP/2 protocol with priority.
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
7
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
8 ###############################################################################
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
9
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
10 use warnings;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
11 use strict;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
12
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
13 use Test::More;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
14
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
15 BEGIN { use FindBin; chdir($FindBin::Bin); }
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
16
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
17 use lib 'lib';
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
18 use Test::Nginx;
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
19 use Test::Nginx::HTTP2;
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
20
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
21 ###############################################################################
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
22
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
23 select STDERR; $| = 1;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
24 select STDOUT; $| = 1;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
25
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
26 my $t = Test::Nginx->new()->has(qw/http http_v2/)->plan(20)
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
27 ->write_file_expand('nginx.conf', <<'EOF');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
28
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
29 %%TEST_GLOBALS%%
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
30
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
31 daemon off;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
32
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
33 events {
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
34 }
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
35
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
36 http {
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
37 %%TEST_GLOBALS_HTTP%%
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
38
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
39 server {
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
40 listen 127.0.0.1:8080 http2;
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
41 server_name localhost;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
42 }
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
43 }
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
44
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
45 EOF
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
46
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
47 $t->run();
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
48
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
49 # file size is slightly beyond initial window size: 2**16 + 80 bytes
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
50
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
51 $t->write_file('t1.html',
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
52 join('', map { sprintf "X%04dXXX", $_ } (1 .. 8202)));
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
53
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
54 $t->write_file('t2.html', 'SEE-THIS');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
55
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
56 ###############################################################################
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
57
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
58 # stream muliplexing + PRIORITY frames
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
59
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
60 my $s = Test::Nginx::HTTP2->new();
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
61 my $sid = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
62 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
63
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
64 my $sid2 = $s->new_stream({ path => '/t2.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
65 $s->read(all => [{ sid => $sid2, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
66
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
67 $s->h2_priority(0, $sid);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
68 $s->h2_priority(255, $sid2);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
69
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
70 $s->h2_window(2**17, $sid);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
71 $s->h2_window(2**17, $sid2);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
72 $s->h2_window(2**17);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
73
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
74 my $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
75 { sid => $sid, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
76 { sid => $sid2, fin => 1 }
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
77 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
78
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
79 my @data = grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
80 is(join(' ', map { $_->{sid} } @data), "$sid2 $sid", 'weight - PRIORITY 1');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
81
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
82 # and vice versa
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
83
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
84 $s = Test::Nginx::HTTP2->new();
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
85 $sid = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
86 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
87
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
88 $sid2 = $s->new_stream({ path => '/t2.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
89 $s->read(all => [{ sid => $sid2, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
90
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
91 $s->h2_priority(255, $sid);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
92 $s->h2_priority(0, $sid2);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
93
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
94 $s->h2_window(2**17, $sid);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
95 $s->h2_window(2**17, $sid2);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
96 $s->h2_window(2**17);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
97
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
98 $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
99 { sid => $sid, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
100 { sid => $sid2, fin => 1 }
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
101 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
102
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
103 @data = grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
104 is(join(' ', map { $_->{sid} } @data), "$sid $sid2", 'weight - PRIORITY 2');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
105
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
106 # stream muliplexing + HEADERS PRIORITY flag
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
107
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
108 $s = Test::Nginx::HTTP2->new();
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
109 $sid = $s->new_stream({ path => '/t1.html', prio => 0 });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
110 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
111
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
112 $sid2 = $s->new_stream({ path => '/t2.html', prio => 255 });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
113 $s->read(all => [{ sid => $sid2, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
114
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
115 $s->h2_window(2**17, $sid);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
116 $s->h2_window(2**17, $sid2);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
117 $s->h2_window(2**17);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
118
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
119 $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
120 { sid => $sid, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
121 { sid => $sid2, fin => 1 }
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
122 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
123
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
124 @data = grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
125 my $sids = join ' ', map { $_->{sid} } @data;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
126 is($sids, "$sid2 $sid", 'weight - HEADERS PRIORITY 1');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
127
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
128 # and vice versa
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
129
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
130 $s = Test::Nginx::HTTP2->new();
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
131 $sid = $s->new_stream({ path => '/t1.html', prio => 255 });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
132 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
133
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
134 $sid2 = $s->new_stream({ path => '/t2.html', prio => 0 });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
135 $s->read(all => [{ sid => $sid2, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
136
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
137 $s->h2_window(2**17, $sid);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
138 $s->h2_window(2**17, $sid2);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
139 $s->h2_window(2**17);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
140
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
141 $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
142 { sid => $sid, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
143 { sid => $sid2, fin => 1 }
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
144 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
145
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
146 @data = grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
147 $sids = join ' ', map { $_->{sid} } @data;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
148 is($sids, "$sid $sid2", 'weight - HEADERS PRIORITY 2');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
149
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
150 # 5.3.1. Stream Dependencies
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
151
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
152 # PRIORITY frame
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
153
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
154 $s = Test::Nginx::HTTP2->new();
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
155
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
156 $s->h2_priority(16, 3, 0);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
157 $s->h2_priority(16, 1, 3);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
158
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
159 $sid = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
160 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
161
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
162 $sid2 = $s->new_stream({ path => '/t2.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
163 $s->read(all => [{ sid => $sid2, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
164
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
165 $s->h2_window(2**17, $sid);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
166 $s->h2_window(2**17, $sid2);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
167 $s->h2_window(2**17);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
168
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
169 $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
170 { sid => $sid, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
171 { sid => $sid2, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
172 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
173
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
174 @data = grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
175 $sids = join ' ', map { $_->{sid} } @data;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
176 is($sids, "$sid2 $sid", 'dependency - PRIORITY 1');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
177
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
178 # and vice versa
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
179
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
180 $s = Test::Nginx::HTTP2->new();
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
181
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
182 $s->h2_priority(16, 1, 0);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
183 $s->h2_priority(16, 3, 1);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
184
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
185 $sid = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
186 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
187
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
188 $sid2 = $s->new_stream({ path => '/t2.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
189 $s->read(all => [{ sid => $sid2, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
190
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
191 $s->h2_window(2**17, $sid);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
192 $s->h2_window(2**17, $sid2);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
193 $s->h2_window(2**17);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
194
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
195 $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
196 { sid => $sid, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
197 { sid => $sid2, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
198 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
199
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
200 @data = grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
201 $sids = join ' ', map { $_->{sid} } @data;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
202 is($sids, "$sid $sid2", 'dependency - PRIORITY 2');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
203
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
204 # PRIORITY - self dependency
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
205
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
206 # 5.3.1. Stream Dependencies
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
207 # A stream cannot depend on itself. An endpoint MUST treat this as a
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
208 # stream error of type PROTOCOL_ERROR.
1506
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
209 # Instead, we respond with a connection error of type PROTOCOL_ERROR.
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
210
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
211 TODO: {
1510
48306d8a2811 Tests: updated h2_priority.t TODOs, change was committed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1506
diff changeset
212 local $TODO = 'not yet' unless $t->has_version('1.17.4');
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
213
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
214 $s = Test::Nginx::HTTP2->new();
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
215 $sid = $s->new_stream();
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
216 $s->read(all => [{ sid => $sid, fin => 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
217
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
218 $s->h2_priority(0, $sid, $sid);
1506
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
219 $frames = $s->read(all => [{ type => 'GOAWAY' }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
220
1506
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
221 my ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
222 is($frame->{last_sid}, $sid, 'dependency - PRIORITY self - GOAWAY');
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
223 is($frame->{code}, 1, 'dependency - PRIORITY self - PROTOCOL_ERROR');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
224
1506
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
225 }
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
226
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
227 # HEADERS PRIORITY flag, reprioritize prior PRIORITY frame records
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
228
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
229 $s = Test::Nginx::HTTP2->new();
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
230
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
231 $s->h2_priority(16, 1, 0);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
232 $s->h2_priority(16, 3, 0);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
233
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
234 $sid = $s->new_stream({ path => '/t1.html', dep => 3 });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
235 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
236
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
237 $sid2 = $s->new_stream({ path => '/t2.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
238 $s->read(all => [{ sid => $sid2, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
239
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
240 $s->h2_window(2**17, $sid);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
241 $s->h2_window(2**17, $sid2);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
242 $s->h2_window(2**17);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
243
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
244 $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
245 { sid => $sid, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
246 { sid => $sid2, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
247 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
248
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
249 @data = grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
250 $sids = join ' ', map { $_->{sid} } @data;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
251 is($sids, "$sid2 $sid", 'dependency - HEADERS PRIORITY 1');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
252
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
253 # and vice versa
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
254
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
255 $s = Test::Nginx::HTTP2->new();
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
256
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
257 $s->h2_priority(16, 1, 0);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
258 $s->h2_priority(16, 3, 0);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
259
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
260 $sid = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
261 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
262
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
263 $sid2 = $s->new_stream({ path => '/t2.html', dep => 1 });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
264 $s->read(all => [{ sid => $sid2, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
265
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
266 $s->h2_window(2**17, $sid);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
267 $s->h2_window(2**17, $sid2);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
268 $s->h2_window(2**17);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
269
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
270 $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
271 { sid => $sid, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
272 { sid => $sid2, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
273 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
274
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
275 @data = grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
276 $sids = join ' ', map { $_->{sid} } @data;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
277 is($sids, "$sid $sid2", 'dependency - HEADERS PRIORITY 2');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
278
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
279 # HEADERS - self dependency
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
280
1506
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
281 TODO: {
1510
48306d8a2811 Tests: updated h2_priority.t TODOs, change was committed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1506
diff changeset
282 local $TODO = 'not yet' unless $t->has_version('1.17.4');
1506
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
283
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
284 $s = Test::Nginx::HTTP2->new();
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
285 $sid = $s->new_stream({ dep => 1 });
1506
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
286 $frames = $s->read(all => [{ type => 'GOAWAY' }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
287
1506
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
288 my ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
289 is($frame->{last_sid}, 0, 'dependency - HEADERS self - GOAWAY');
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
290 is($frame->{code}, 1, 'dependency - HEADERS self - PROTOCOL_ERROR');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
291
1506
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
292 }
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
293
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
294 # PRIORITY frame, weighted dependencies
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
295
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
296 $s = Test::Nginx::HTTP2->new();
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
297
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
298 $s->h2_priority(16, 5, 0);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
299 $s->h2_priority(255, 1, 5);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
300 $s->h2_priority(0, 3, 5);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
301
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
302 $sid = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
303 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
304
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
305 $sid2 = $s->new_stream({ path => '/t2.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
306 $s->read(all => [{ sid => $sid2, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
307
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
308 my $sid3 = $s->new_stream({ path => '/t2.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
309 $s->read(all => [{ sid => $sid3, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
310
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
311 $s->h2_window(2**16, 1);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
312 $s->h2_window(2**16, 3);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
313 $s->h2_window(2**16, 5);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
314 $s->h2_window(2**16);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
315
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
316 $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
317 { sid => $sid, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
318 { sid => $sid2, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
319 { sid => $sid3, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
320 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
321
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
322 @data = grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
323 $sids = join ' ', map { $_->{sid} } @data;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
324 is($sids, "$sid3 $sid $sid2", 'weighted dependency - PRIORITY 1');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
325
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
326 # and vice versa
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
327
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
328 $s = Test::Nginx::HTTP2->new();
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
329
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
330 $s->h2_priority(16, 5, 0);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
331 $s->h2_priority(0, 1, 5);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
332 $s->h2_priority(255, 3, 5);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
333
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
334 $sid = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
335 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
336
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
337 $sid2 = $s->new_stream({ path => '/t2.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
338 $s->read(all => [{ sid => $sid2, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
339
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
340 $sid3 = $s->new_stream({ path => '/t2.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
341 $s->read(all => [{ sid => $sid3, fin => 0x4 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
342
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
343 $s->h2_window(2**16, 1);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
344 $s->h2_window(2**16, 3);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
345 $s->h2_window(2**16, 5);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
346 $s->h2_window(2**16);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
347
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
348 $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
349 { sid => $sid, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
350 { sid => $sid2, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
351 { sid => $sid3, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
352 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
353
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
354 @data = grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
355 $sids = join ' ', map { $_->{sid} } @data;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
356 is($sids, "$sid3 $sid2 $sid", 'weighted dependency - PRIORITY 2');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
357
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
358 # PRIORITY - reprioritization with circular dependency - after [3] removed
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
359 # initial dependency tree:
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
360 # 1 <- [3] <- 5
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
361
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
362 $s = Test::Nginx::HTTP2->new();
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
363
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
364 $s->h2_window(2**18);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
365
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
366 $s->h2_priority(16, 1, 0);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
367 $s->h2_priority(16, 3, 1);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
368 $s->h2_priority(16, 5, 3);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
369
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
370 $sid = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
371 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
372
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
373 $sid2 = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
374 $s->read(all => [{ sid => $sid2, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
375
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
376 $sid3 = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
377 $s->read(all => [{ sid => $sid3, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
378
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
379 $s->h2_window(2**16, $sid2);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
380
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
381 $frames = $s->read(all => [{ sid => $sid2, fin => 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
382 $sids = join ' ', map { $_->{sid} } grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
383 is($sids, $sid2, 'removed dependency');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
384
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
385 for (1 .. 40) {
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
386 $s->read(all => [{ sid => $s->new_stream(), fin => 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
387 }
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
388
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
389 # make circular dependency
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
390 # 1 <- 5 -- current dependency tree before reprioritization
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
391 # 5 <- 1
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
392 # 1 <- 5
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
393
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
394 $s->h2_priority(16, 1, 5);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
395 $s->h2_priority(16, 5, 1);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
396
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
397 $s->h2_window(2**16, $sid);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
398 $s->h2_window(2**16, $sid3);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
399
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
400 $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
401 { sid => $sid, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
402 { sid => $sid3, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
403 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
404
1506
c4c2275cda55 Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
405 my ($frame) = grep { $_->{type} eq "DATA" && $_->{sid} == $sid } @$frames;
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
406 is($frame->{length}, 81, 'removed dependency - first stream');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
407
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
408 ($frame) = grep { $_->{type} eq "DATA" && $_->{sid} == $sid3 } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
409 is($frame->{length}, 81, 'removed dependency - last stream');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
410
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
411 # PRIORITY - reprioritization with circular dependency - exclusive [5]
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
412 # 1 <- [5] <- 3
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
413
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
414 $s = Test::Nginx::HTTP2->new();
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
415
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
416 $s->h2_window(2**18);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
417
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
418 $s->h2_priority(16, 1, 0);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
419 $s->h2_priority(16, 3, 1);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
420 $s->h2_priority(16, 5, 1, excl => 1);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
421
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
422 $sid = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
423 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
424
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
425 $sid2 = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
426 $s->read(all => [{ sid => $sid2, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
427
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
428 $sid3 = $s->new_stream({ path => '/t1.html' });
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
429 $s->read(all => [{ sid => $sid3, length => 2**16 - 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
430
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
431 $s->h2_window(2**16, $sid);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
432
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
433 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
434 $sids = join ' ', map { $_->{sid} } grep { $_->{type} eq "DATA" } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
435 is($sids, $sid, 'exclusive dependency - parent removed');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
436
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
437 # make circular dependency
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
438 # 5 <- 3 -- current dependency tree before reprioritization
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
439 # 3 <- 5
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
440
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
441 $s->h2_priority(16, 5, 3);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
442
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
443 $s->h2_window(2**16, $sid2);
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
444 $s->h2_window(2**16, $sid3);
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
445
948
4dc302d8e04f Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents: 876
diff changeset
446 $frames = $s->read(all => [
876
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
447 { sid => $sid2, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
448 { sid => $sid3, fin => 1 },
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
449 ]);
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
450
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
451 ($frame) = grep { $_->{type} eq "DATA" && $_->{sid} == $sid2 } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
452 is($frame->{length}, 81, 'exclusive dependency - first stream');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
453
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
454 ($frame) = grep { $_->{type} eq "DATA" && $_->{sid} == $sid3 } @$frames;
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
455 is($frame->{length}, 81, 'exclusive dependency - last stream');
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
456
a6abbfed42c0 Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff changeset
457 ###############################################################################