Mercurial > hg > nginx-tests
annotate h2_priority.t @ 953:2bbab9bd73e5
Tests: added proxy_bind test with port.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 21 Jun 2016 18:38:32 +0300 |
parents | e9064d691790 |
children | 882267679006 |
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 { |
952
e9064d691790
Tests: converted tests to run in parallel.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
948
diff
changeset
|
40 listen 127.0.0.1:%%PORT_0%% 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. |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
209 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
210 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
211 $sid = $s->new_stream(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
212 $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
|
213 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
214 $s->h2_priority(0, $sid, $sid); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
215 $frames = $s->read(all => [{ type => 'RST_STREAM' }]); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
216 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
217 my ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
218 is($frame->{sid}, $sid, 'dependency - PRIORITY self - RST_STREAM'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
219 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
|
220 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
221 # 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
|
222 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
223 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
224 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
225 $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
|
226 $s->h2_priority(16, 3, 0); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
227 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
228 $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
|
229 $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
|
230 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
231 $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
|
232 $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
|
233 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
234 $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
|
235 $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
|
236 $s->h2_window(2**17); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
237 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
238 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
239 { sid => $sid, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
240 { sid => $sid2, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
241 ]); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
242 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
243 @data = grep { $_->{type} eq "DATA" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
244 $sids = join ' ', map { $_->{sid} } @data; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
245 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
|
246 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
247 # and vice versa |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
248 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
249 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
250 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
251 $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
|
252 $s->h2_priority(16, 3, 0); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
253 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
254 $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
|
255 $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
|
256 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
257 $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
|
258 $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
|
259 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
260 $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
|
261 $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
|
262 $s->h2_window(2**17); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
263 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
264 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
265 { sid => $sid, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
266 { sid => $sid2, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
267 ]); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
268 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
269 @data = grep { $_->{type} eq "DATA" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
270 $sids = join ' ', map { $_->{sid} } @data; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
271 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
|
272 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
273 # HEADERS - self dependency |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
274 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
275 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
276 $sid = $s->new_stream({ dep => 1 }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
277 $frames = $s->read(all => [{ type => 'RST_STREAM' }]); |
876
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 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
280 is($frame->{sid}, $sid, 'dependency - HEADERS self - RST_STREAM'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
281 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
|
282 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
283 # PRIORITY frame, weighted dependencies |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
284 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
285 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
286 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
287 $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
|
288 $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
|
289 $s->h2_priority(0, 3, 5); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
290 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
291 $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
|
292 $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
|
293 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
294 $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
|
295 $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
|
296 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
297 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
|
298 $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
|
299 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
300 $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
|
301 $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
|
302 $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
|
303 $s->h2_window(2**16); |
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 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
306 { sid => $sid, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
307 { sid => $sid2, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
308 { sid => $sid3, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
309 ]); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
310 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
311 @data = grep { $_->{type} eq "DATA" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
312 $sids = join ' ', map { $_->{sid} } @data; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
313 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
|
314 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
315 # and vice versa |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
316 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
317 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
318 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
319 $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
|
320 $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
|
321 $s->h2_priority(255, 3, 5); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
322 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
323 $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
|
324 $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
|
325 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
326 $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
|
327 $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
|
328 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
329 $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
|
330 $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
|
331 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
332 $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
|
333 $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
|
334 $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
|
335 $s->h2_window(2**16); |
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 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
338 { sid => $sid, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
339 { sid => $sid2, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
340 { sid => $sid3, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
341 ]); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
342 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
343 @data = grep { $_->{type} eq "DATA" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
344 $sids = join ' ', map { $_->{sid} } @data; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
345 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
|
346 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
347 # 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
|
348 # initial dependency tree: |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
349 # 1 <- [3] <- 5 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
350 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
351 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
352 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
353 $s->h2_window(2**18); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
354 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
355 $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
|
356 $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
|
357 $s->h2_priority(16, 5, 3); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
358 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
359 $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
|
360 $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
|
361 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
362 $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
|
363 $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
|
364 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
365 $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
|
366 $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
|
367 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
368 $s->h2_window(2**16, $sid2); |
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 $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
|
371 $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
|
372 is($sids, $sid2, 'removed dependency'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
373 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
374 for (1 .. 40) { |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
375 $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
|
376 } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
377 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
378 # make circular dependency |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
379 # 1 <- 5 -- current dependency tree before reprioritization |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
380 # 5 <- 1 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
381 # 1 <- 5 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
382 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
383 $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
|
384 $s->h2_priority(16, 5, 1); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
385 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
386 $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
|
387 $s->h2_window(2**16, $sid3); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
388 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
389 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
390 { sid => $sid, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
391 { sid => $sid3, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
392 ]); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
393 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
394 ($frame) = grep { $_->{type} eq "DATA" && $_->{sid} == $sid } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
395 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
|
396 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
397 ($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
|
398 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
|
399 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
400 # PRIORITY - reprioritization with circular dependency - exclusive [5] |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
401 # 1 <- [5] <- 3 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
402 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
403 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
404 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
405 $s->h2_window(2**18); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
406 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
407 $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
|
408 $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
|
409 $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
|
410 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
411 $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
|
412 $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
|
413 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
414 $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
|
415 $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
|
416 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
417 $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
|
418 $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
|
419 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
420 $s->h2_window(2**16, $sid); |
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 $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
|
423 $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
|
424 is($sids, $sid, 'exclusive dependency - parent removed'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
425 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
426 # make circular dependency |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
427 # 5 <- 3 -- current dependency tree before reprioritization |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
428 # 3 <- 5 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
429 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
430 $s->h2_priority(16, 5, 3); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
431 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
432 $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
|
433 $s->h2_window(2**16, $sid3); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
434 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
435 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
436 { sid => $sid2, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
437 { sid => $sid3, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
438 ]); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
439 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
440 ($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
|
441 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
|
442 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
443 ($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
|
444 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
|
445 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
446 ############################################################################### |