Mercurial > hg > nginx-tests
annotate h2_priority.t @ 1836:74cffa9d4c43
Tests: enabled session reuse via TLS session tickets.
This fixes tests with TLSv1.3 enabled when using BoringSSL, since
for TLSv1.3 it only supports session reuse via TLS session tickets,
and not server-side session cache.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 23 Mar 2023 19:50:02 +0300 |
parents | 5ac6efbe5552 |
children | 236d038dc04a |
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 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
211 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
212 $sid = $s->new_stream(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
213 $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
|
214 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
215 $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
|
216 $frames = $s->read(all => [{ type => 'GOAWAY' }]); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
217 |
1506
c4c2275cda55
Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
218 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
|
219 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
|
220 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
|
221 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
222 # 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
|
223 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
224 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
225 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
226 $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
|
227 $s->h2_priority(16, 3, 0); |
876
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 $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
|
230 $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
|
231 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
232 $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
|
233 $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
|
234 |
948
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, $sid); |
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, $sid2); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
237 $s->h2_window(2**17); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
238 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
239 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
240 { sid => $sid, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
241 { sid => $sid2, fin => 1 }, |
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 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
244 @data = grep { $_->{type} eq "DATA" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
245 $sids = join ' ', map { $_->{sid} } @data; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
246 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
|
247 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
248 # and vice versa |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
249 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
250 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
251 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
252 $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
|
253 $s->h2_priority(16, 3, 0); |
876
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 $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
|
256 $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
|
257 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
258 $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
|
259 $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
|
260 |
948
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, $sid); |
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, $sid2); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
263 $s->h2_window(2**17); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
264 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
265 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
266 { sid => $sid, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
267 { sid => $sid2, fin => 1 }, |
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 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
270 @data = grep { $_->{type} eq "DATA" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
271 $sids = join ' ', map { $_->{sid} } @data; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
272 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
|
273 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
274 # HEADERS - self dependency |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
275 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
276 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
277 $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
|
278 $frames = $s->read(all => [{ type => 'GOAWAY' }]); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
279 |
1693
5ac6efbe5552
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1510
diff
changeset
|
280 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
1506
c4c2275cda55
Tests: expect GOAWAY on HTTP/2 frames with dependency on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
281 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
|
282 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
|
283 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
284 # PRIORITY frame, weighted dependencies |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
285 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
286 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
287 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
288 $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
|
289 $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
|
290 $s->h2_priority(0, 3, 5); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
291 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
292 $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
|
293 $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
|
294 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
295 $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
|
296 $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
|
297 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
298 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
|
299 $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
|
300 |
948
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, 1); |
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, 3); |
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, 5); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
304 $s->h2_window(2**16); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
305 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
306 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
307 { sid => $sid, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
308 { sid => $sid2, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
309 { sid => $sid3, fin => 1 }, |
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 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
312 @data = grep { $_->{type} eq "DATA" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
313 $sids = join ' ', map { $_->{sid} } @data; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
314 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
|
315 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
316 # and vice versa |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
317 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
318 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
319 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
320 $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
|
321 $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
|
322 $s->h2_priority(255, 3, 5); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
323 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
324 $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
|
325 $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
|
326 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
327 $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
|
328 $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
|
329 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
330 $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
|
331 $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
|
332 |
948
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, 1); |
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, 3); |
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, 5); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
336 $s->h2_window(2**16); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
337 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
338 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
339 { sid => $sid, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
340 { sid => $sid2, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
341 { sid => $sid3, fin => 1 }, |
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 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
344 @data = grep { $_->{type} eq "DATA" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
345 $sids = join ' ', map { $_->{sid} } @data; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
346 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
|
347 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
348 # 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
|
349 # initial dependency tree: |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
350 # 1 <- [3] <- 5 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
351 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
352 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
353 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
354 $s->h2_window(2**18); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
355 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
356 $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
|
357 $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
|
358 $s->h2_priority(16, 5, 3); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
359 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
360 $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
|
361 $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
|
362 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
363 $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
|
364 $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
|
365 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
366 $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
|
367 $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
|
368 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
369 $s->h2_window(2**16, $sid2); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
370 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
371 $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
|
372 $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
|
373 is($sids, $sid2, 'removed dependency'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
374 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
375 for (1 .. 40) { |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
376 $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
|
377 } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
378 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
379 # make circular dependency |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
380 # 1 <- 5 -- current dependency tree before reprioritization |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
381 # 5 <- 1 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
382 # 1 <- 5 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
383 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
384 $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
|
385 $s->h2_priority(16, 5, 1); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
386 |
948
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, $sid); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
388 $s->h2_window(2**16, $sid3); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
389 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
390 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
391 { sid => $sid, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
392 { sid => $sid3, fin => 1 }, |
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 |
1693
5ac6efbe5552
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1510
diff
changeset
|
395 ($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
|
396 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
|
397 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
398 ($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
|
399 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
|
400 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
401 # PRIORITY - reprioritization with circular dependency - exclusive [5] |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
402 # 1 <- [5] <- 3 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
403 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
404 $s = Test::Nginx::HTTP2->new(); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
405 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
406 $s->h2_window(2**18); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
407 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
408 $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
|
409 $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
|
410 $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
|
411 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
412 $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
|
413 $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
|
414 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
415 $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
|
416 $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
|
417 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
418 $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
|
419 $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
|
420 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
421 $s->h2_window(2**16, $sid); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
422 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
423 $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
|
424 $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
|
425 is($sids, $sid, 'exclusive dependency - parent removed'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
426 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
427 # make circular dependency |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
428 # 5 <- 3 -- current dependency tree before reprioritization |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
429 # 3 <- 5 |
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_priority(16, 5, 3); |
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 $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
|
434 $s->h2_window(2**16, $sid3); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
435 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
436 $frames = $s->read(all => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
437 { sid => $sid2, fin => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
438 { sid => $sid3, fin => 1 }, |
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 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
441 ($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
|
442 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
|
443 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
444 ($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
|
445 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
|
446 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
447 ############################################################################### |