Mercurial > hg > nginx-tests
annotate h2.t @ 1102:89d7d4d1be40
Tests: whitespace fixes.
author | Andrey Zelenkov <zelenkov@nginx.com> |
---|---|
date | Wed, 28 Dec 2016 16:28:33 +0300 |
parents | f72f43eda2a6 |
children | d42cc683970d |
rev | line source |
---|---|
646 | 1 #!/usr/bin/perl |
2 | |
3 # (C) Sergey Kandaurov | |
4 # (C) Nginx, Inc. | |
5 | |
6 # Tests for HTTP/2 protocol [RFC7540]. | |
7 | |
8 ############################################################################### | |
9 | |
10 use warnings; | |
11 use strict; | |
12 | |
13 use Test::More; | |
14 | |
15 use Socket qw/ CRLF /; | |
16 | |
17 BEGIN { use FindBin; chdir($FindBin::Bin); } | |
18 | |
19 use lib 'lib'; | |
20 use Test::Nginx; | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
21 use Test::Nginx::HTTP2; |
646 | 22 |
23 ############################################################################### | |
24 | |
25 select STDERR; $| = 1; | |
26 select STDOUT; $| = 1; | |
27 | |
1002
3b1ee8acc4db
Tests: added charset and gzip prerequisites in h2.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
997
diff
changeset
|
28 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite charset gzip/) |
1065
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
29 ->plan(141); |
704
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
30 |
646 | 31 $t->write_file_expand('nginx.conf', <<'EOF'); |
32 | |
33 %%TEST_GLOBALS%% | |
34 | |
35 daemon off; | |
36 | |
37 events { | |
38 } | |
39 | |
40 http { | |
41 %%TEST_GLOBALS_HTTP%% | |
42 | |
43 server { | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
44 listen 127.0.0.1:8080 http2; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
45 listen 127.0.0.1:8081; |
646 | 46 server_name localhost; |
47 | |
48 location / { | |
49 add_header X-Header X-Foo; | |
50 add_header X-Sent-Foo $http_x_foo; | |
51 add_header X-Referer $http_referer; | |
52 return 200 'body'; | |
53 } | |
54 location /t { | |
55 } | |
56 location /gzip.html { | |
57 gzip on; | |
58 gzip_min_length 0; | |
847
7de036e89770
Tests: added HTTP/2 test with gzip vary.
Sergey Kandaurov <pluknet@nginx.com>
parents:
846
diff
changeset
|
59 gzip_vary on; |
646 | 60 alias %%TESTDIR%%/t2.html; |
61 } | |
680
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
62 location /frame_size { |
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
63 http2_chunk_size 64k; |
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
64 alias %%TESTDIR%%/t1.html; |
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
65 output_buffers 2 1m; |
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
66 } |
651
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
67 location /chunk_size { |
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
68 http2_chunk_size 1; |
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
69 return 200 'body'; |
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
70 } |
646 | 71 location /redirect { |
72 error_page 405 /; | |
73 return 405; | |
74 } | |
75 location /return301 { | |
76 return 301; | |
77 } | |
78 location /return301_absolute { | |
79 return 301 text; | |
80 } | |
81 location /return301_relative { | |
82 return 301 /; | |
83 } | |
846
9b5e1c5f0240
Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents:
845
diff
changeset
|
84 location /charset { |
9b5e1c5f0240
Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents:
845
diff
changeset
|
85 charset utf-8; |
9b5e1c5f0240
Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents:
845
diff
changeset
|
86 return 200; |
9b5e1c5f0240
Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents:
845
diff
changeset
|
87 } |
646 | 88 } |
89 | |
90 server { | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
91 listen 127.0.0.1:8082 http2; |
646 | 92 server_name localhost; |
93 return 200 first; | |
94 } | |
95 | |
96 server { | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
97 listen 127.0.0.1:8082 http2; |
646 | 98 server_name localhost2; |
99 return 200 second; | |
100 } | |
654
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
101 |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
102 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
103 listen 127.0.0.1:8083 http2; |
654
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
104 server_name localhost; |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
105 |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
106 http2_max_concurrent_streams 1; |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
107 } |
684
96666f621dbc
Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
680
diff
changeset
|
108 |
96666f621dbc
Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
680
diff
changeset
|
109 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
110 listen 127.0.0.1:8084 http2; |
714
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
111 server_name localhost; |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
112 |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
113 http2_recv_timeout 1s; |
842
60b3e0cfba77
Tests: adjusted h2.t configuration for per-request timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
841
diff
changeset
|
114 client_header_timeout 1s; |
60b3e0cfba77
Tests: adjusted h2.t configuration for per-request timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
841
diff
changeset
|
115 send_timeout 1s; |
714
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
116 } |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
117 |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
118 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
119 listen 127.0.0.1:8085 http2; |
714
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
120 server_name localhost; |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
121 |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
122 http2_idle_timeout 1s; |
842
60b3e0cfba77
Tests: adjusted h2.t configuration for per-request timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
841
diff
changeset
|
123 client_body_timeout 1s; |
755
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
124 |
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
125 location /proxy2/ { |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
871
diff
changeset
|
126 add_header X-Body $request_body; |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
127 proxy_pass http://127.0.0.1:8081/; |
755
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
128 } |
714
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
129 } |
763
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
130 |
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
131 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
132 listen 127.0.0.1:8086 http2; |
763
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
133 server_name localhost; |
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
134 |
990
eb49d29d5447
Tests: redo 892737e9fd31 without flaky send_timeout adjustments.
Sergey Kandaurov <pluknet@nginx.com>
parents:
984
diff
changeset
|
135 send_timeout 1s; |
763
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
136 } |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
137 |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
138 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
139 listen 127.0.0.1:8087 http2; |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
140 server_name localhost; |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
141 |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
142 client_header_timeout 1s; |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
143 client_body_timeout 1s; |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
144 |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
145 location /proxy/ { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
146 proxy_pass http://127.0.0.1:8081/; |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
147 } |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
148 } |
646 | 149 } |
150 | |
151 EOF | |
152 | |
741
a2e7f5ff3aa8
Tests: hid unwanted output with old OpenSSL.
Sergey Kandaurov <pluknet@nginx.com>
parents:
740
diff
changeset
|
153 $t->run(); |
646 | 154 |
155 # file size is slightly beyond initial window size: 2**16 + 80 bytes | |
156 | |
157 $t->write_file('t1.html', | |
158 join('', map { sprintf "X%04dXXX", $_ } (1 .. 8202))); | |
159 $t->write_file('tbig.html', | |
723
bc4d6e2bd031
Tests: adjusted HTTP/2 test to trigger write handler in v2 module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
722
diff
changeset
|
160 join('', map { sprintf "XX%06dXX", $_ } (1 .. 500000))); |
646 | 161 |
162 $t->write_file('t2.html', 'SEE-THIS'); | |
163 | |
164 ############################################################################### | |
165 | |
738
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
166 # Upgrade mechanism |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
167 |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
168 my $r = http(<<EOF); |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
169 GET / HTTP/1.1 |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
170 Host: localhost |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
171 Connection: Upgrade, HTTP2-Settings |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
172 Upgrade: h2c |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
173 HTTP2-Settings: AAMAAABkAAQAAP__ |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
174 |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
175 EOF |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
176 |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
177 SKIP: { |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
178 skip 'no Upgrade-based negotiation', 2 if $r !~ m!HTTP/1.1 101!; |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
179 |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
180 like($r, qr!Connection: Upgrade!, 'upgrade - connection'); |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
181 like($r, qr!Upgrade: h2c!, 'upgrade - token'); |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
182 |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
183 } |
0881219c0699
Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents:
737
diff
changeset
|
184 |
646 | 185 # SETTINGS |
186 | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
187 my $s = Test::Nginx::HTTP2->new(port(8080), pure => 1); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
188 my $frames = $s->read(all => [ |
646 | 189 { type => 'WINDOW_UPDATE' }, |
190 { type => 'SETTINGS'} | |
191 ]); | |
192 | |
193 my ($frame) = grep { $_->{type} eq 'WINDOW_UPDATE' } @$frames; | |
194 ok($frame, 'WINDOW_UPDATE frame'); | |
195 is($frame->{flags}, 0, 'WINDOW_UPDATE zero flags'); | |
196 is($frame->{sid}, 0, 'WINDOW_UPDATE zero sid'); | |
197 is($frame->{length}, 4, 'WINDOW_UPDATE fixed length'); | |
198 | |
199 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames; | |
200 ok($frame, 'SETTINGS frame'); | |
201 is($frame->{flags}, 0, 'SETTINGS flags'); | |
655
75ecd26b8831
Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
654
diff
changeset
|
202 is($frame->{sid}, 0, 'SETTINGS stream'); |
646 | 203 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
204 $s->h2_settings(1); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
205 $s->h2_settings(0); |
646 | 206 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
207 $frames = $s->read(all => [{ type => 'SETTINGS' }]); |
646 | 208 |
209 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames; | |
210 ok($frame, 'SETTINGS frame ack'); | |
211 is($frame->{flags}, 1, 'SETTINGS flags ack'); | |
212 | |
213 # PING | |
214 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
215 $s->h2_ping('SEE-THIS'); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
216 $frames = $s->read(all => [{ type => 'PING' }]); |
646 | 217 |
218 ($frame) = grep { $_->{type} eq "PING" } @$frames; | |
219 ok($frame, 'PING frame'); | |
220 is($frame->{value}, 'SEE-THIS', 'PING payload'); | |
221 is($frame->{flags}, 1, 'PING flags ack'); | |
655
75ecd26b8831
Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
654
diff
changeset
|
222 is($frame->{sid}, 0, 'PING stream'); |
646 | 223 |
714
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
224 # timeouts |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
225 |
945
d73bef563aea
Tests: speed up HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
944
diff
changeset
|
226 SKIP: { |
d73bef563aea
Tests: speed up HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
944
diff
changeset
|
227 skip 'long tests', 6 unless $ENV{TEST_NGINX_UNSAFE}; |
d73bef563aea
Tests: speed up HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
944
diff
changeset
|
228 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
229 push my @s, Test::Nginx::HTTP2->new(port(8084), pure => 1); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
230 push @s, Test::Nginx::HTTP2->new(port(8084), pure => 1); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
231 $s[-1]->h2_ping('SEE-THIS'); |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
232 push @s, Test::Nginx::HTTP2->new(port(8085), pure => 1); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
233 push @s, Test::Nginx::HTTP2->new(port(8085), pure => 1); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
234 $s[-1]->h2_ping('SEE-THIS'); |
714
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
235 |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
236 select undef, undef, undef, 2.1; |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
237 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
238 $frames = (shift @s)->read(all => [{ type => "GOAWAY" }]); |
714
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
239 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
240 ok($frame, 'recv timeout - new connection GOAWAY'); |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
241 is($frame->{code}, 1, 'recv timeout - new connection code'); |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
242 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
243 $frames = (shift @s)->read(all => [{ type => "GOAWAY" }]); |
714
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
244 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
245 is($frame, undef, 'recv timeout - idle connection GOAWAY'); |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
246 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
247 $frames = (shift @s)->read(all => [{ type => "GOAWAY" }]); |
714
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
248 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
249 is($frame, undef, 'idle timeout - new connection GOAWAY'); |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
250 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
251 $frames = (shift @s)->read(all => [{ type => "GOAWAY" }]); |
714
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
252 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
253 ok($frame, 'idle timeout - idle connection GOAWAY'); |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
254 is($frame->{code}, 0, 'idle timeout - idle connection code'); |
ccc9f389e1f8
Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
712
diff
changeset
|
255 |
945
d73bef563aea
Tests: speed up HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
944
diff
changeset
|
256 } |
d73bef563aea
Tests: speed up HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
944
diff
changeset
|
257 |
759
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
258 # GOAWAY |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
259 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
260 Test::Nginx::HTTP2->new()->h2_goaway(0, 0, 5); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
261 Test::Nginx::HTTP2->new()->h2_goaway(0, 0, 5, 'foobar'); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
262 Test::Nginx::HTTP2->new()->h2_goaway(0, 0, 5, 'foobar', split => [ 8, 8, 4 ]); |
759
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
263 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
264 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
265 $s->h2_goaway(0, 0, 5); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
266 $s->h2_goaway(0, 0, 5); |
759
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
267 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
268 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
269 $s->h2_goaway(0, 0, 5, 'foobar', len => 0); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
270 $frames = $s->read(all => [{ type => "GOAWAY" }]); |
759
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
271 |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
272 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
273 ok($frame, 'GOAWAY invalid length - GOAWAY frame'); |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
274 is($frame->{code}, 6, 'GOAWAY invalid length - GOAWAY FRAME_SIZE_ERROR'); |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
275 |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
276 # 6.8. GOAWAY |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
277 # An endpoint MUST treat a GOAWAY frame with a stream identifier other |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
278 # than 0x0 as a connection error (Section 5.4.1) of type PROTOCOL_ERROR. |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
279 |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
280 TODO: { |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
281 local $TODO = 'not yet'; |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
282 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
283 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
284 $s->h2_goaway(1, 0, 5, 'foobar'); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
285 $frames = $s->read(all => [{ type => "GOAWAY" }], wait => 0.5); |
759
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
286 |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
287 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
288 ok($frame, 'GOAWAY invalid stream - GOAWAY frame'); |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
289 is($frame->{code}, 1, 'GOAWAY invalid stream - GOAWAY PROTOCOL_ERROR'); |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
290 |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
291 } |
6406eee6366c
Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
758
diff
changeset
|
292 |
760
4db976a91540
Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
759
diff
changeset
|
293 # client-initiated PUSH_PROMISE, just to ensure nothing went wrong |
4db976a91540
Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
759
diff
changeset
|
294 # N.B. other implementation returns zero code, which is not anyhow regulated |
4db976a91540
Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
759
diff
changeset
|
295 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
296 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
297 syswrite($s->{socket}, pack("x2C2xN", 4, 0x5, 1)); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
298 $frames = $s->read(all => [{ type => "GOAWAY" }]); |
760
4db976a91540
Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
759
diff
changeset
|
299 |
4db976a91540
Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
759
diff
changeset
|
300 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
4db976a91540
Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
759
diff
changeset
|
301 ok($frame, 'client-initiated PUSH_PROMISE - GOAWAY frame'); |
4db976a91540
Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
759
diff
changeset
|
302 is($frame->{code}, 1, 'client-initiated PUSH_PROMISE - GOAWAY PROTOCOL_ERROR'); |
4db976a91540
Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
759
diff
changeset
|
303 |
646 | 304 # GET |
305 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
306 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
307 my $sid = $s->new_stream(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
308 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 309 |
310 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
311 ok($frame, 'HEADERS frame'); | |
312 is($frame->{sid}, $sid, 'HEADERS stream'); | |
313 is($frame->{headers}->{':status'}, 200, 'HEADERS status'); | |
314 is($frame->{headers}->{'x-header'}, 'X-Foo', 'HEADERS header'); | |
315 | |
316 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
317 ok($frame, 'DATA frame'); | |
318 is($frame->{length}, length 'body', 'DATA length'); | |
319 is($frame->{data}, 'body', 'DATA payload'); | |
320 | |
321 # GET in the new stream on same connection | |
322 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
323 $sid = $s->new_stream(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
324 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 325 |
326 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
327 is($frame->{sid}, $sid, 'HEADERS stream 2'); | |
328 is($frame->{headers}->{':status'}, 200, 'HEADERS status 2'); | |
329 is($frame->{headers}->{'x-header'}, 'X-Foo', 'HEADERS header 2'); | |
330 | |
331 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
332 ok($frame, 'DATA frame 2'); | |
333 is($frame->{sid}, $sid, 'HEADERS stream 2'); | |
334 is($frame->{length}, length 'body', 'DATA length 2'); | |
335 is($frame->{data}, 'body', 'DATA payload 2'); | |
336 | |
337 # HEAD | |
338 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
339 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
340 $sid = $s->new_stream({ method => 'HEAD' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
341 $frames = $s->read(all => [{ sid => $sid, fin => 0x4 }]); |
646 | 342 |
343 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
344 is($frame->{sid}, $sid, 'HEAD - HEADERS'); | |
345 is($frame->{headers}->{':status'}, 200, 'HEAD - HEADERS status'); | |
346 is($frame->{headers}->{'x-header'}, 'X-Foo', 'HEAD - HEADERS header'); | |
347 | |
348 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
349 is($frame, undef, 'HEAD - no body'); | |
350 | |
351 # range filter | |
352 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
353 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
354 $sid = $s->new_stream({ headers => [ |
646 | 355 { name => ':method', value => 'GET', mode => 0 }, |
356 { name => ':scheme', value => 'http', mode => 0 }, | |
357 { name => ':path', value => '/t1.html', mode => 1 }, | |
653
5ad620022234
Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
652
diff
changeset
|
358 { name => ':authority', value => 'localhost', mode => 1 }, |
646 | 359 { name => 'range', value => 'bytes=10-19', mode => 1 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
360 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 361 |
362 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
363 is($frame->{headers}->{':status'}, 206, 'range - HEADERS status'); | |
364 | |
365 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
366 is($frame->{length}, 10, 'range - DATA length'); | |
367 is($frame->{data}, '002XXXX000', 'range - DATA payload'); | |
368 | |
651
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
369 # http2_chunk_size=1 |
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
370 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
371 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
372 $sid = $s->new_stream({ path => '/chunk_size' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
373 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
651
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
374 |
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
375 my @data = grep { $_->{type} eq "DATA" } @$frames; |
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
376 is(@data, 4, 'chunk_size frames'); |
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
377 is(join(' ', map { $_->{data} } @data), 'b o d y', 'chunk_size data'); |
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
378 is(join(' ', map { $_->{flags} } @data), '0 0 0 1', 'chunk_size flags'); |
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
379 |
646 | 380 # CONTINUATION |
381 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
382 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
383 $sid = $s->new_stream({ continuation => 1, headers => [ |
646 | 384 { name => ':method', value => 'HEAD', mode => 1 }, |
385 { name => ':scheme', value => 'http', mode => 0 }, | |
653
5ad620022234
Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
652
diff
changeset
|
386 { name => ':path', value => '/', mode => 0 }, |
5ad620022234
Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
652
diff
changeset
|
387 { name => ':authority', value => 'localhost', mode => 1 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
388 $s->h2_continue($sid, { continuation => 1, headers => [ |
646 | 389 { name => 'x-foo', value => 'X-Bar', mode => 2 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
390 $s->h2_continue($sid, { headers => [ |
646 | 391 { name => 'referer', value => 'foo', mode => 2 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
392 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 393 |
394 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
395 is($frame, undef, 'CONTINUATION - fragment 1'); | |
396 | |
397 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
398 is($frame->{headers}->{'x-sent-foo'}, 'X-Bar', 'CONTINUATION - fragment 2'); | |
399 is($frame->{headers}->{'x-referer'}, 'foo', 'CONTINUATION - fragment 3'); | |
400 | |
699
5768830f01c4
Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents:
698
diff
changeset
|
401 # CONTINUATION - in the middle of request header field |
5768830f01c4
Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents:
698
diff
changeset
|
402 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
403 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
404 $sid = $s->new_stream({ continuation => [ 2, 4, 1, 5 ], headers => [ |
699
5768830f01c4
Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents:
698
diff
changeset
|
405 { name => ':method', value => 'HEAD', mode => 1 }, |
5768830f01c4
Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents:
698
diff
changeset
|
406 { name => ':scheme', value => 'http', mode => 0 }, |
5768830f01c4
Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents:
698
diff
changeset
|
407 { name => ':path', value => '/', mode => 0 }, |
5768830f01c4
Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents:
698
diff
changeset
|
408 { name => ':authority', value => 'localhost', mode => 1 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
409 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
699
5768830f01c4
Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents:
698
diff
changeset
|
410 |
5768830f01c4
Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents:
698
diff
changeset
|
411 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
5768830f01c4
Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents:
698
diff
changeset
|
412 is($frame->{headers}->{':status'}, 200, 'CONTINUATION - in header field'); |
5768830f01c4
Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents:
698
diff
changeset
|
413 |
761
01feb5d4d7a4
Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
760
diff
changeset
|
414 # CONTINUATION on a closed stream |
01feb5d4d7a4
Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
760
diff
changeset
|
415 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
416 $s->h2_continue(1, { headers => [ |
761
01feb5d4d7a4
Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
760
diff
changeset
|
417 { name => 'x-foo', value => 'X-Bar', mode => 2 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
418 $frames = $s->read(all => [{ sid => 1, fin => 1 }]); |
761
01feb5d4d7a4
Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
760
diff
changeset
|
419 |
01feb5d4d7a4
Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
760
diff
changeset
|
420 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
01feb5d4d7a4
Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
760
diff
changeset
|
421 is($frame->{type}, 'GOAWAY', 'GOAWAY - CONTINUATION closed stream'); |
01feb5d4d7a4
Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
760
diff
changeset
|
422 is($frame->{code}, 1, 'GOAWAY - CONTINUATION closed stream - PROTOCOL_ERROR'); |
01feb5d4d7a4
Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
760
diff
changeset
|
423 |
646 | 424 # frame padding |
425 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
426 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
427 $sid = $s->new_stream({ padding => 42, headers => [ |
646 | 428 { name => ':method', value => 'GET', mode => 0 }, |
429 { name => ':scheme', value => 'http', mode => 0 }, | |
653
5ad620022234
Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
652
diff
changeset
|
430 { name => ':path', value => '/', mode => 0 }, |
5ad620022234
Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
652
diff
changeset
|
431 { name => ':authority', value => 'localhost', mode => 1 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
432 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 433 |
434 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
435 is($frame->{headers}->{':status'}, 200, 'padding - HEADERS status'); | |
436 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
437 $sid = $s->new_stream({ headers => [ |
646 | 438 { name => ':method', value => 'GET', mode => 0 }, |
439 { name => ':scheme', value => 'http', mode => 0 }, | |
653
5ad620022234
Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
652
diff
changeset
|
440 { name => ':path', value => '/', mode => 0 }, |
5ad620022234
Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
652
diff
changeset
|
441 { name => ':authority', value => 'localhost', mode => 1 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
442 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 443 |
444 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
445 is($frame->{headers}->{':status'}, 200, 'padding - next stream'); | |
446 | |
821
d75000247e1f
Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents:
818
diff
changeset
|
447 # padding followed by CONTINUATION |
d75000247e1f
Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents:
818
diff
changeset
|
448 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
449 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
450 $sid = $s->new_stream({ padding => 42, continuation => [ 2, 4, 1, 5 ], |
821
d75000247e1f
Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents:
818
diff
changeset
|
451 headers => [ |
d75000247e1f
Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents:
818
diff
changeset
|
452 { name => ':method', value => 'GET', mode => 1 }, |
d75000247e1f
Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents:
818
diff
changeset
|
453 { name => ':scheme', value => 'http', mode => 0 }, |
d75000247e1f
Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents:
818
diff
changeset
|
454 { name => ':path', value => '/', mode => 0 }, |
d75000247e1f
Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents:
818
diff
changeset
|
455 { name => ':authority', value => 'localhost', mode => 1 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
456 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
821
d75000247e1f
Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents:
818
diff
changeset
|
457 |
d75000247e1f
Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents:
818
diff
changeset
|
458 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
d75000247e1f
Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents:
818
diff
changeset
|
459 is($frame->{headers}->{':status'}, 200, 'padding - CONTINUATION'); |
d75000247e1f
Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents:
818
diff
changeset
|
460 |
646 | 461 # internal redirect |
462 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
463 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
464 $sid = $s->new_stream({ path => '/redirect' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
465 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 466 |
467 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
468 is($frame->{headers}->{':status'}, 405, 'redirect - HEADERS'); | |
469 | |
470 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
471 ok($frame, 'redirect - DATA'); | |
472 is($frame->{data}, 'body', 'redirect - DATA payload'); | |
473 | |
474 # return 301 with absolute URI | |
475 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
476 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
477 $sid = $s->new_stream({ path => '/return301_absolute' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
478 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 479 |
480 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
481 is($frame->{headers}->{':status'}, 301, 'return 301 absolute - status'); | |
482 is($frame->{headers}->{'location'}, 'text', 'return 301 absolute - location'); | |
483 | |
484 # return 301 with relative URI | |
485 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
486 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
487 $sid = $s->new_stream({ path => '/return301_relative' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
488 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 489 |
490 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
491 is($frame->{headers}->{':status'}, 301, 'return 301 relative - status'); | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
492 is($frame->{headers}->{'location'}, 'http://localhost:' . port(8080) . '/', |
646 | 493 'return 301 relative - location'); |
494 | |
495 # return 301 with relative URI and ':authority' request header field | |
496 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
497 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
498 $sid = $s->new_stream({ headers => [ |
646 | 499 { name => ':method', value => 'GET', mode => 0 }, |
500 { name => ':scheme', value => 'http', mode => 0 }, | |
501 { name => ':path', value => '/return301_relative', mode => 2 }, | |
502 { name => ':authority', value => 'localhost', mode => 2 }]}); | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
503 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 504 |
505 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
506 is($frame->{headers}->{':status'}, 301, | |
507 'return 301 relative - authority - status'); | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
508 is($frame->{headers}->{'location'}, 'http://localhost:' . port(8080) . '/', |
646 | 509 'return 301 relative - authority - location'); |
510 | |
511 # return 301 with relative URI and 'host' request header field | |
512 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
513 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
514 $sid = $s->new_stream({ headers => [ |
646 | 515 { name => ':method', value => 'GET', mode => 0 }, |
516 { name => ':scheme', value => 'http', mode => 0 }, | |
517 { name => ':path', value => '/return301_relative', mode => 2 }, | |
518 { name => 'host', value => 'localhost', mode => 2 }]}); | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
519 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 520 |
521 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
522 is($frame->{headers}->{':status'}, 301, | |
523 'return 301 relative - host - status'); | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
524 is($frame->{headers}->{'location'}, 'http://localhost:' . port(8080) . '/', |
646 | 525 'return 301 relative - host - location'); |
526 | |
527 # virtual host | |
528 | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
529 $s = Test::Nginx::HTTP2->new(port(8082)); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
530 $sid = $s->new_stream({ headers => [ |
646 | 531 { name => ':method', value => 'GET', mode => 0 }, |
532 { name => ':scheme', value => 'http', mode => 0 }, | |
533 { name => ':path', value => '/', mode => 0 }, | |
534 { name => 'host', value => 'localhost', mode => 2 }]}); | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
535 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 536 |
537 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
538 is($frame->{headers}->{':status'}, 200, | |
539 'virtual host - host - status'); | |
540 | |
541 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
542 is($frame->{data}, 'first', 'virtual host - host - DATA'); | |
543 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
544 $sid = $s->new_stream({ headers => [ |
646 | 545 { name => ':method', value => 'GET', mode => 0 }, |
546 { name => ':scheme', value => 'http', mode => 0 }, | |
547 { name => ':path', value => '/', mode => 0 }, | |
548 { name => ':authority', value => 'localhost', mode => 2 }]}); | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
549 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 550 |
551 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
552 is($frame->{headers}->{':status'}, 200, | |
553 'virtual host - authority - status'); | |
554 | |
555 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
556 is($frame->{data}, 'first', 'virtual host - authority - DATA'); | |
557 | |
558 # virtual host - second | |
559 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
560 $sid = $s->new_stream({ headers => [ |
646 | 561 { name => ':method', value => 'GET', mode => 0 }, |
562 { name => ':scheme', value => 'http', mode => 0 }, | |
563 { name => ':path', value => '/', mode => 0 }, | |
564 { name => 'host', value => 'localhost2', mode => 2 }]}); | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
565 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 566 |
567 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
568 is($frame->{headers}->{':status'}, 200, | |
569 'virtual host 2 - host - status'); | |
570 | |
571 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
572 is($frame->{data}, 'second', 'virtual host 2 - host - DATA'); | |
573 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
574 $sid = $s->new_stream({ headers => [ |
646 | 575 { name => ':method', value => 'GET', mode => 0 }, |
576 { name => ':scheme', value => 'http', mode => 0 }, | |
577 { name => ':path', value => '/', mode => 0 }, | |
578 { name => ':authority', value => 'localhost2', mode => 2 }]}); | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
579 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 580 |
581 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
582 is($frame->{headers}->{':status'}, 200, | |
583 'virtual host 2 - authority - status'); | |
584 | |
585 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
586 is($frame->{data}, 'second', 'virtual host 2 - authority - DATA'); | |
587 | |
588 # gzip tests for internal nginx version | |
589 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
590 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
591 $sid = $s->new_stream({ headers => [ |
646 | 592 { name => ':method', value => 'GET', mode => 0 }, |
593 { name => ':scheme', value => 'http', mode => 0 }, | |
594 { name => ':path', value => '/gzip.html' }, | |
653
5ad620022234
Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
652
diff
changeset
|
595 { name => ':authority', value => 'localhost', mode => 1 }, |
646 | 596 { name => 'accept-encoding', value => 'gzip' }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
597 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 598 |
599 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | |
600 is($frame->{headers}->{'content-encoding'}, 'gzip', 'gzip - encoding'); | |
847
7de036e89770
Tests: added HTTP/2 test with gzip vary.
Sergey Kandaurov <pluknet@nginx.com>
parents:
846
diff
changeset
|
601 is($frame->{headers}->{'vary'}, 'Accept-Encoding', 'gzip - vary'); |
646 | 602 |
603 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
647
4e36550410b3
Tests: h2.t fixes for older perl versions, and gzip test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
646
diff
changeset
|
604 gunzip_like($frame->{data}, qr/^SEE-THIS\Z/, 'gzip - DATA'); |
646 | 605 |
846
9b5e1c5f0240
Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents:
845
diff
changeset
|
606 # charset |
9b5e1c5f0240
Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents:
845
diff
changeset
|
607 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
608 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
609 $sid = $s->new_stream({ path => '/charset' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
610 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
846
9b5e1c5f0240
Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents:
845
diff
changeset
|
611 |
9b5e1c5f0240
Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents:
845
diff
changeset
|
612 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
9b5e1c5f0240
Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents:
845
diff
changeset
|
613 is($frame->{headers}->{'content-type'}, 'text/plain; charset=utf-8', 'charset'); |
9b5e1c5f0240
Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents:
845
diff
changeset
|
614 |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
615 # partial request header frame received (field split), |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
616 # the rest of frame is received after client header timeout |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
617 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
618 $s = Test::Nginx::HTTP2->new(port(8087)); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
619 $sid = $s->new_stream({ path => '/t2.html', split => [35], |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
620 split_delay => 2.1 }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
621 $frames = $s->read(all => [{ type => 'RST_STREAM' }]); |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
622 |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
623 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
624 ok($frame, 'client header timeout'); |
841
6a401b5fa812
Tests: check timed out HTTP/2 streams for proper RST_STREAM code.
Sergey Kandaurov <pluknet@nginx.com>
parents:
840
diff
changeset
|
625 is($frame->{code}, 1, 'client header timeout - protocol error'); |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
626 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
627 $s->h2_ping('SEE-THIS'); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
628 $frames = $s->read(all => [{ type => 'PING' }]); |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
629 |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
630 ($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames; |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
631 ok($frame, 'client header timeout - PING'); |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
632 |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
633 # partial request body data frame received, the rest is after body timeout |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
634 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
635 $s = Test::Nginx::HTTP2->new(port(8087)); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
636 $sid = $s->new_stream({ path => '/proxy/t2.html', body_more => 1 }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
637 $s->h2_body('TEST', { split => [10], split_delay => 2.1 }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
638 $frames = $s->read(all => [{ type => 'RST_STREAM' }]); |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
639 |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
640 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
641 ok($frame, 'client body timeout'); |
841
6a401b5fa812
Tests: check timed out HTTP/2 streams for proper RST_STREAM code.
Sergey Kandaurov <pluknet@nginx.com>
parents:
840
diff
changeset
|
642 is($frame->{code}, 1, 'client body timeout - protocol error'); |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
643 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
644 $s->h2_ping('SEE-THIS'); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
645 $frames = $s->read(all => [{ type => 'PING' }]); |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
646 |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
647 ($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames; |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
648 ok($frame, 'client body timeout - PING'); |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
649 |
852
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
650 # proxied request with logging pristine request header field (e.g., referer) |
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
651 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
652 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
653 $sid = $s->new_stream({ headers => [ |
852
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
654 { name => ':method', value => 'GET' }, |
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
655 { name => ':scheme', value => 'http' }, |
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
656 { name => ':path', value => '/proxy2/' }, |
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
657 { name => ':authority', value => 'localhost' }, |
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
658 { name => 'referer', value => 'foo' }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
659 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
852
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
660 |
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
661 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
662 is($frame->{headers}->{':status'}, 200, 'proxy with logging request headers'); |
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
663 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
664 $sid = $s->new_stream(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
665 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
852
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
666 |
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
667 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
668 ok($frame->{headers}, 'proxy with logging request headers - next'); |
e0d6ba59968f
Tests: added HTTP/2 proxy test with logging request headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
850
diff
changeset
|
669 |
646 | 670 # initial window size, client side |
671 | |
672 # 6.9.2. Initial Flow-Control Window Size | |
673 # When an HTTP/2 connection is first established, new streams are | |
674 # created with an initial flow-control window size of 65,535 octets. | |
675 # The connection flow-control window is also 65,535 octets. | |
676 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
677 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
678 $sid = $s->new_stream({ path => '/t1.html' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
679 $frames = $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]); |
646 | 680 |
681 # with the default http2_chunk_size, data is divided into 8 data frames | |
682 | |
651
9f66f0029dca
Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
650
diff
changeset
|
683 @data = grep { $_->{type} eq "DATA" } @$frames; |
646 | 684 my $lengths = join ' ', map { $_->{length} } @data; |
685 is($lengths, '8192 8192 8192 8192 8192 8192 8192 8191', | |
686 'iws - stream blocked on initial window size'); | |
687 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
688 $s->h2_ping('SEE-THIS'); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
689 $frames = $s->read(all => [{ type => 'PING' }]); |
646 | 690 |
691 ($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames; | |
692 ok($frame, 'iws - PING not blocked'); | |
693 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
694 $s->h2_window(2**16, $sid); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
695 $frames = $s->read(wait => 0.2); |
646 | 696 is(@$frames, 0, 'iws - updated stream window'); |
697 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
698 $s->h2_window(2**16); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
699 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 700 |
701 @data = grep { $_->{type} eq "DATA" } @$frames; | |
702 my $sum = eval join '+', map { $_->{length} } @data; | |
703 is($sum, 81, 'iws - updated connection window'); | |
704 | |
705 # SETTINGS (initial window size, client side) | |
706 | |
707 # 6.9.2. Initial Flow-Control Window Size | |
708 # Both endpoints can adjust the initial window size for new streams by | |
709 # including a value for SETTINGS_INITIAL_WINDOW_SIZE in the SETTINGS | |
710 # frame that forms part of the connection preface. The connection | |
711 # flow-control window can only be changed using WINDOW_UPDATE frames. | |
712 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
713 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
714 $s->h2_settings(0, 0x4 => 2**17); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
715 $s->h2_window(2**17); |
646 | 716 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
717 $sid = $s->new_stream({ path => '/t1.html' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
718 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 719 |
720 @data = grep { $_->{type} eq "DATA" } @$frames; | |
721 $sum = eval join '+', map { $_->{length} } @data; | |
722 is($sum, 2**16 + 80, 'iws - increased'); | |
723 | |
724 # probe for negative available space in a flow control window | |
725 | |
726 # 6.9.2. Initial Flow-Control Window Size | |
727 # A change to SETTINGS_INITIAL_WINDOW_SIZE can cause the available | |
728 # space in a flow-control window to become negative. A sender MUST | |
729 # track the negative flow-control window and MUST NOT send new flow- | |
730 # controlled frames until it receives WINDOW_UPDATE frames that cause | |
731 # the flow-control window to become positive. | |
732 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
733 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
734 $sid = $s->new_stream({ path => '/t1.html' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
735 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]); |
646 | 736 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
737 $s->h2_window(1); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
738 $s->h2_settings(0, 0x4 => 42); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
739 $s->h2_window(1024, $sid); |
646 | 740 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
741 $frames = $s->read(all => [{ type => 'SETTINGS' }]); |
646 | 742 |
743 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames; | |
744 ok($frame, 'negative window - SETTINGS frame ack'); | |
745 is($frame->{flags}, 1, 'negative window - SETTINGS flags ack'); | |
746 | |
747 ($frame) = grep { $_->{type} ne 'SETTINGS' } @$frames; | |
748 is($frame, undef, 'negative window - no data'); | |
749 | |
750 # predefined window size, minus new iws settings, minus window update | |
751 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
752 $s->h2_window(2**16 - 1 - 42 - 1024, $sid); |
646 | 753 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
754 $frames = $s->read(wait => 0.2); |
646 | 755 is(@$frames, 0, 'zero window - no data'); |
756 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
757 $s->h2_window(1, $sid); |
646 | 758 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
759 $frames = $s->read(all => [{ sid => $sid, length => 1 }]); |
646 | 760 is(@$frames, 1, 'positive window'); |
712
649af6069976
Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
707
diff
changeset
|
761 |
649af6069976
Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
707
diff
changeset
|
762 SKIP: { |
649af6069976
Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
707
diff
changeset
|
763 skip 'failed connection', 2 unless @$frames; |
649af6069976
Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
707
diff
changeset
|
764 |
646 | 765 is(@$frames[0]->{type}, 'DATA', 'positive window - data'); |
766 is(@$frames[0]->{length}, 1, 'positive window - data length'); | |
767 | |
712
649af6069976
Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
707
diff
changeset
|
768 } |
649af6069976
Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
707
diff
changeset
|
769 |
704
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
770 # ask write handler in sending large response |
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
771 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
772 $sid = $s->new_stream({ path => '/tbig.html' }); |
704
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
773 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
774 $s->h2_window(2**30, $sid); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
775 $s->h2_window(2**30); |
704
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
776 |
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
777 sleep 1; |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
778 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
704
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
779 |
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
780 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
781 is($frame->{headers}->{':status'}, 200, 'large response - HEADERS'); |
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
782 |
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
783 @data = grep { $_->{type} eq "DATA" } @$frames; |
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
784 $sum = eval join '+', map { $_->{length} } @data; |
723
bc4d6e2bd031
Tests: adjusted HTTP/2 test to trigger write handler in v2 module.
Sergey Kandaurov <pluknet@nginx.com>
parents:
722
diff
changeset
|
785 is($sum, 5000000, 'large response - DATA'); |
704
626bc3a0fdaa
Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
702
diff
changeset
|
786 |
794
fed83003c45c
Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
789
diff
changeset
|
787 # Make sure http2 write handler doesn't break a connection. |
fed83003c45c
Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
789
diff
changeset
|
788 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
789 $sid = $s->new_stream(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
790 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
794
fed83003c45c
Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
789
diff
changeset
|
791 |
fed83003c45c
Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
789
diff
changeset
|
792 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
fed83003c45c
Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
789
diff
changeset
|
793 is($frame->{headers}->{':status'}, 200, 'new stream after large response'); |
fed83003c45c
Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
789
diff
changeset
|
794 |
763
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
795 # write event send timeout |
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
796 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
797 $s = Test::Nginx::HTTP2->new(port(8086)); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
798 $sid = $s->new_stream({ path => '/tbig.html' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
799 $s->h2_window(2**30, $sid); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
800 $s->h2_window(2**30); |
763
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
801 |
990
eb49d29d5447
Tests: redo 892737e9fd31 without flaky send_timeout adjustments.
Sergey Kandaurov <pluknet@nginx.com>
parents:
984
diff
changeset
|
802 select undef, undef, undef, 2.1; |
763
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
803 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
804 $s->h2_ping('SEE-THIS'); |
763
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
805 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
806 $frames = $s->read(all => [{ type => 'PING' }]); |
763
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
807 ok(!grep ({ $_->{type} eq "PING" } @$frames), 'large response - send timeout'); |
2ba4058848d6
Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
762
diff
changeset
|
808 |
740
3e2676108d69
Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
739
diff
changeset
|
809 # stream with large response queued on write - RST_STREAM handling |
3e2676108d69
Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
739
diff
changeset
|
810 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
811 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
812 $sid = $s->new_stream({ path => '/tbig.html' }); |
740
3e2676108d69
Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
739
diff
changeset
|
813 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
814 $s->h2_window(2**30, $sid); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
815 $s->h2_window(2**30); |
740
3e2676108d69
Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
739
diff
changeset
|
816 |
3e2676108d69
Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
739
diff
changeset
|
817 select undef, undef, undef, 0.4; |
3e2676108d69
Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
739
diff
changeset
|
818 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
819 $s->h2_rst($sid, 8); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
820 $s->read(all => [{ sid => $sid, fin => 1 }], wait => 0.2); |
740
3e2676108d69
Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
739
diff
changeset
|
821 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
822 $sid = $s->new_stream(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
823 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
740
3e2676108d69
Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
739
diff
changeset
|
824 |
3e2676108d69
Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
739
diff
changeset
|
825 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
3e2676108d69
Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
739
diff
changeset
|
826 is($frame->{sid}, 3, 'large response - queued with RST_STREAM'); |
3e2676108d69
Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents:
739
diff
changeset
|
827 |
680
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
828 # SETTINGS_MAX_FRAME_SIZE |
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
829 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
830 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
831 $sid = $s->new_stream({ path => '/frame_size' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
832 $s->h2_window(2**18, 1); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
833 $s->h2_window(2**18); |
680
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
834 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
835 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
680
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
836 @data = grep { $_->{type} eq "DATA" } @$frames; |
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
837 is($data[0]->{length}, 2**14, 'max frame size - default'); |
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
838 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
839 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
840 $s->h2_settings(0, 0x5 => 2**15); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
841 $sid = $s->new_stream({ path => '/frame_size' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
842 $s->h2_window(2**18, 1); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
843 $s->h2_window(2**18); |
680
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
844 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
845 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
680
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
846 @data = grep { $_->{type} eq "DATA" } @$frames; |
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
847 is($data[0]->{length}, 2**15, 'max frame size - custom'); |
85e368105c8b
Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents:
679
diff
changeset
|
848 |
646 | 849 # stream multiplexing + WINDOW_UPDATE |
850 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
851 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
852 $sid = $s->new_stream({ path => '/t1.html' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
853 $frames = $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]); |
646 | 854 |
855 @data = grep { $_->{type} eq "DATA" } @$frames; | |
856 $sum = eval join '+', map { $_->{length} } @data; | |
857 is($sum, 2**16 - 1, 'multiple - stream1 data'); | |
858 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
859 my $sid2 = $s->new_stream({ path => '/t1.html' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
860 $frames = $s->read(all => [{ sid => $sid2, fin => 0x4 }]); |
646 | 861 |
862 @data = grep { $_->{type} eq "DATA" } @$frames; | |
863 is(@data, 0, 'multiple - stream2 no data'); | |
864 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
865 $s->h2_window(2**17, $sid); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
866 $s->h2_window(2**17, $sid2); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
867 $s->h2_window(2**17); |
646 | 868 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
869 $frames = $s->read(all => [ |
646 | 870 { sid => $sid, fin => 1 }, |
871 { sid => $sid2, fin => 1 } | |
872 ]); | |
873 | |
874 @data = grep { $_->{type} eq "DATA" && $_->{sid} == $sid } @$frames; | |
875 $sum = eval join '+', map { $_->{length} } @data; | |
876 is($sum, 81, 'multiple - stream1 remain data'); | |
877 | |
878 @data = grep { $_->{type} eq "DATA" && $_->{sid} == $sid2 } @$frames; | |
879 $sum = eval join '+', map { $_->{length} } @data; | |
880 is($sum, 2**16 + 80, 'multiple - stream2 full data'); | |
881 | |
654
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
882 # http2_max_concurrent_streams |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
883 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
884 $s = Test::Nginx::HTTP2->new(port(8083), pure => 1); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
885 $frames = $s->read(all => [{ type => 'SETTINGS' }]); |
654
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
886 |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
887 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames; |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
888 is($frame->{3}, 1, 'http2_max_concurrent_streams SETTINGS'); |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
889 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
890 $s->h2_window(2**18); |
654
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
891 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
892 $sid = $s->new_stream({ path => '/t1.html' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
893 $frames = $s->read(all => [{ sid => $sid, length => 2 ** 16 - 1 }]); |
654
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
894 |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
895 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames; |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
896 is($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams'); |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
897 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
898 $sid2 = $s->new_stream({ path => '/t1.html' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
899 $frames = $s->read(all => [{ type => 'RST_STREAM' }]); |
654
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
900 |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
901 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid2 } @$frames; |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
902 isnt($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams 2'); |
a64fe1054fb4
Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
653
diff
changeset
|
903 |
667
0247e314e991
Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
662
diff
changeset
|
904 ($frame) = grep { $_->{type} eq "RST_STREAM" && $_->{sid} == $sid2 } @$frames; |
0247e314e991
Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
662
diff
changeset
|
905 is($frame->{sid}, $sid2, 'http2_max_concurrent_streams RST_STREAM sid'); |
0247e314e991
Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
662
diff
changeset
|
906 is($frame->{length}, 4, 'http2_max_concurrent_streams RST_STREAM length'); |
0247e314e991
Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
662
diff
changeset
|
907 is($frame->{flags}, 0, 'http2_max_concurrent_streams RST_STREAM flags'); |
0247e314e991
Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
662
diff
changeset
|
908 is($frame->{code}, 7, 'http2_max_concurrent_streams RST_STREAM code'); |
0247e314e991
Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
662
diff
changeset
|
909 |
715
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
910 # properly skip header field that's not/never indexed from discarded streams |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
911 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
912 $sid2 = $s->new_stream({ headers => [ |
715
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
913 { name => ':method', value => 'GET' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
914 { name => ':scheme', value => 'http' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
915 { name => ':path', value => '/', mode => 6 }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
916 { name => ':authority', value => 'localhost' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
917 { name => 'x-foo', value => 'Foo', mode => 2 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
918 $frames = $s->read(all => [{ type => 'RST_STREAM' }]); |
715
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
919 |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
920 # also if split across writes |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
921 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
922 $sid2 = $s->new_stream({ split => [ 22 ], headers => [ |
715
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
923 { name => ':method', value => 'GET' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
924 { name => ':scheme', value => 'http' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
925 { name => ':path', value => '/', mode => 6 }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
926 { name => ':authority', value => 'localhost' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
927 { name => 'x-bar', value => 'Bar', mode => 2 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
928 $frames = $s->read(all => [{ type => 'RST_STREAM' }]); |
715
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
929 |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
930 # also if split across frames |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
931 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
932 $sid2 = $s->new_stream({ continuation => [ 17 ], headers => [ |
715
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
933 { name => ':method', value => 'GET' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
934 { name => ':scheme', value => 'http' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
935 { name => ':path', value => '/', mode => 6 }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
936 { name => ':authority', value => 'localhost' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
937 { name => 'x-baz', value => 'Baz', mode => 2 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
938 $frames = $s->read(all => [{ type => 'RST_STREAM' }]); |
715
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
939 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
940 $s->h2_window(2**16, $sid); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
941 $s->read(all => [{ sid => $sid, fin => 1 }]); |
661
c99c30afc1c9
Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
660
diff
changeset
|
942 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
943 $sid = $s->new_stream({ headers => [ |
715
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
944 { name => ':method', value => 'GET' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
945 { name => ':scheme', value => 'http' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
946 { name => ':path', value => '/t2.html' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
947 { name => ':authority', value => 'localhost' }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
948 # make sure that discarded streams updated dynamic table |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
949 { name => 'x-foo', value => 'Foo', mode => 0 }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
950 { name => 'x-bar', value => 'Bar', mode => 0 }, |
9ee52e137f3d
Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
714
diff
changeset
|
951 { name => 'x-baz', value => 'Baz', mode => 0 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
952 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
661
c99c30afc1c9
Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
660
diff
changeset
|
953 |
c99c30afc1c9
Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
660
diff
changeset
|
954 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames; |
c99c30afc1c9
Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
660
diff
changeset
|
955 is($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams 3'); |
c99c30afc1c9
Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
660
diff
changeset
|
956 |
646 | 957 |
958 # some invalid cases below | |
959 | |
728
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
960 # invalid connection preface |
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
961 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
962 $s = Test::Nginx::HTTP2->new(port(8080), preface => 'x' x 16, pure => 1); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
963 $frames = $s->read(all => [{ type => 'GOAWAY' }]); |
728
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
964 |
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
965 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
966 ok($frame, 'invalid preface - GOAWAY frame'); |
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
967 is($frame->{code}, 1, 'invalid preface - error code'); |
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
968 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
969 my $preface = 'PRI * HTTP/2.0' . CRLF . CRLF . 'x' x 8; |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
970 $s = Test::Nginx::HTTP2->new(port(8080), preface => $preface, pure => 1); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
971 $frames = $s->read(all => [{ type => 'GOAWAY' }]); |
728
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
972 |
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
973 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
974 ok($frame, 'invalid preface 2 - GOAWAY frame'); |
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
975 is($frame->{code}, 1, 'invalid preface 2 - error code'); |
61800918f647
Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents:
727
diff
changeset
|
976 |
646 | 977 # GOAWAY on SYN_STREAM with even StreamID |
978 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
979 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
980 $s->new_stream({ path => '/' }, 2); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
981 $frames = $s->read(all => [{ type => 'GOAWAY' }]); |
646 | 982 |
983 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | |
984 ok($frame, 'even stream - GOAWAY frame'); | |
985 is($frame->{code}, 1, 'even stream - error code'); | |
669
0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
668
diff
changeset
|
986 is($frame->{last_sid}, 0, 'even stream - last stream'); |
646 | 987 |
988 # GOAWAY on SYN_STREAM with backward StreamID | |
989 | |
669
0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
668
diff
changeset
|
990 # 5.1.1. Stream Identifiers |
0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
668
diff
changeset
|
991 # The first use of a new stream identifier implicitly closes all |
0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
668
diff
changeset
|
992 # streams in the "idle" state <..> with a lower-valued stream identifier. |
0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
668
diff
changeset
|
993 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
994 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
995 $sid = $s->new_stream({ path => '/' }, 3); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
996 $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 997 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
998 $sid2 = $s->new_stream({ path => '/' }, 1); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
999 $frames = $s->read(all => [{ type => 'GOAWAY' }]); |
646 | 1000 |
1001 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | |
1002 ok($frame, 'backward stream - GOAWAY frame'); | |
1003 is($frame->{code}, 1, 'backward stream - error code'); | |
669
0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
668
diff
changeset
|
1004 is($frame->{last_sid}, $sid, 'backward stream - last stream'); |
646 | 1005 |
669
0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
668
diff
changeset
|
1006 # GOAWAY on the second SYN_STREAM with same StreamID |
646 | 1007 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1008 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1009 $sid = $s->new_stream({ path => '/' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1010 $s->read(all => [{ sid => $sid, fin => 1 }]); |
646 | 1011 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1012 $sid2 = $s->new_stream({ path => '/' }, $sid); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1013 $frames = $s->read(all => [{ type => 'GOAWAY' }]); |
669
0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
668
diff
changeset
|
1014 |
0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
668
diff
changeset
|
1015 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
668
diff
changeset
|
1016 ok($frame, 'dup stream - GOAWAY frame'); |
646 | 1017 is($frame->{code}, 1, 'dup stream - error code'); |
669
0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
668
diff
changeset
|
1018 is($frame->{last_sid}, $sid, 'dup stream - last stream'); |
646 | 1019 |
754
84a52b6d6343
Tests: HTTP/2 regression test for incomplete HEADERS payload.
Sergey Kandaurov <pluknet@nginx.com>
parents:
748
diff
changeset
|
1020 # aborted stream with zero HEADERS payload followed by client connection close |
84a52b6d6343
Tests: HTTP/2 regression test for incomplete HEADERS payload.
Sergey Kandaurov <pluknet@nginx.com>
parents:
748
diff
changeset
|
1021 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1022 Test::Nginx::HTTP2->new()->new_stream({ split => [ 9 ], abort => 1 }); |
754
84a52b6d6343
Tests: HTTP/2 regression test for incomplete HEADERS payload.
Sergey Kandaurov <pluknet@nginx.com>
parents:
748
diff
changeset
|
1023 |
697
46f698a7e59c
Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents:
696
diff
changeset
|
1024 # unknown frame type |
46f698a7e59c
Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents:
696
diff
changeset
|
1025 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1026 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1027 $s->h2_unknown('payload'); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1028 $s->h2_ping('SEE-THIS'); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1029 $frames = $s->read(all => [{ type => 'PING' }]); |
697
46f698a7e59c
Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents:
696
diff
changeset
|
1030 |
46f698a7e59c
Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents:
696
diff
changeset
|
1031 ($frame) = grep { $_->{type} eq "PING" } @$frames; |
46f698a7e59c
Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents:
696
diff
changeset
|
1032 is($frame->{value}, 'SEE-THIS', 'unknown frame type'); |
46f698a7e59c
Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents:
696
diff
changeset
|
1033 |
755
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
1034 # graceful shutdown with stream waiting on HEADERS payload |
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
1035 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
1036 my $grace = Test::Nginx::HTTP2->new(port(8084)); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1037 $grace->new_stream({ split => [ 9 ], abort => 1 }); |
755
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
1038 |
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
1039 # graceful shutdown with stream waiting on WINDOW_UPDATE |
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
1040 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
1041 my $grace2 = Test::Nginx::HTTP2->new(port(8084)); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1042 $sid = $grace2->new_stream({ path => '/t1.html' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1043 $grace2->read(all => [{ sid => $sid, length => 2**16 - 1 }]); |
755
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
1044 |
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
1045 # graceful shutdown waiting on incomplete request body DATA frames |
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
1046 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
1047 my $grace3 = Test::Nginx::HTTP2->new(port(8085)); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1048 $sid = $grace3->new_stream({ path => '/proxy2/t2.html', body_more => 1 }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1049 $grace3->h2_body('TEST', { body_more => 1 }); |
755
f95aa716624e
Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents:
754
diff
changeset
|
1050 |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
1051 # partial request body data frame with connection close after body timeout |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
1052 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
1053 my $grace4 = Test::Nginx::HTTP2->new(port(8087)); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1054 $sid = $grace4->new_stream({ path => '/proxy/t2.html', body_more => 1 }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1055 $grace4->h2_body('TEST', { split => [ 12 ], abort => 1 }); |
830
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
1056 |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
1057 select undef, undef, undef, 1.1; |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
1058 undef $grace4; |
3d12316e6f41
Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
829
diff
changeset
|
1059 |
1065
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1060 # GOAWAY without awaiting active streams, further streams ignored |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1061 |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1062 SKIP: { |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1063 skip 'win32', 3 if $^O eq 'MSWin32'; |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1064 |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1065 TODO: { |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1066 local $TODO = 'not yet' unless $t->has_version('1.11.6'); |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1067 |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1068 $s = Test::Nginx::HTTP2->new(port(8080)); |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1069 $sid = $s->new_stream({ path => '/t1.html' }); |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1070 $s->read(all => [{ sid => $sid, length => 2**16 - 1 }]); |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1071 |
1092
f72f43eda2a6
Tests: simplified nginx reload in HTTP/2 GOAWAY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
1072 kill 'HUP', $t->read_file('nginx.pid'); |
1065
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1073 |
1066
23418577df58
Tests: tweak HTTP/2 GOAWAY test with no new stream after reload.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1065
diff
changeset
|
1074 $frames = $s->read(all => [{ type => 'GOAWAY' }]); |
23418577df58
Tests: tweak HTTP/2 GOAWAY test with no new stream after reload.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1065
diff
changeset
|
1075 |
23418577df58
Tests: tweak HTTP/2 GOAWAY test with no new stream after reload.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1065
diff
changeset
|
1076 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
23418577df58
Tests: tweak HTTP/2 GOAWAY test with no new stream after reload.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1065
diff
changeset
|
1077 is($frame->{last_sid}, $sid, 'GOAWAY with active stream - last sid'); |
23418577df58
Tests: tweak HTTP/2 GOAWAY test with no new stream after reload.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1065
diff
changeset
|
1078 |
1065
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1079 $sid2 = $s->new_stream(); |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1080 $frames = $s->read(all => [{ sid => $sid2, fin => 0x4 }], wait => 0.5); |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1081 |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1082 ($frame) = grep { $_->{type} eq 'HEADERS' } @$frames; |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1083 is($frame, undef, 'GOAWAY with active stream - no new stream'); |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1084 |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1085 } |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1086 |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1087 $s->h2_window(100, $sid); |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1088 $s->h2_window(100); |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1089 $frames = $s->read(all => [{ sid => $sid, fin => 0x1 }]); |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1090 |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1091 @data = grep { $_->{type} eq "DATA" && $_->{sid} == $sid } @$frames; |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1092 $sum = eval join '+', map { $_->{length} } @data; |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1093 is($sum, 81, 'GOAWAY with active stream - active stream DATA after GOAWAY'); |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1094 |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1095 } |
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1096 |
990
eb49d29d5447
Tests: redo 892737e9fd31 without flaky send_timeout adjustments.
Sergey Kandaurov <pluknet@nginx.com>
parents:
984
diff
changeset
|
1097 # GOAWAY - force closing a connection by server with idle or active streams |
eb49d29d5447
Tests: redo 892737e9fd31 without flaky send_timeout adjustments.
Sergey Kandaurov <pluknet@nginx.com>
parents:
984
diff
changeset
|
1098 |
1065
2d4343a47c6d
Tests: more HTTP/2 GOAWAY tests with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1020
diff
changeset
|
1099 $s = Test::Nginx::HTTP2->new(); |
990
eb49d29d5447
Tests: redo 892737e9fd31 without flaky send_timeout adjustments.
Sergey Kandaurov <pluknet@nginx.com>
parents:
984
diff
changeset
|
1100 $sid = $s->new_stream(); |
eb49d29d5447
Tests: redo 892737e9fd31 without flaky send_timeout adjustments.
Sergey Kandaurov <pluknet@nginx.com>
parents:
984
diff
changeset
|
1101 $s->read(all => [{ sid => $sid, fin => 1 }]); |
eb49d29d5447
Tests: redo 892737e9fd31 without flaky send_timeout adjustments.
Sergey Kandaurov <pluknet@nginx.com>
parents:
984
diff
changeset
|
1102 |
eb49d29d5447
Tests: redo 892737e9fd31 without flaky send_timeout adjustments.
Sergey Kandaurov <pluknet@nginx.com>
parents:
984
diff
changeset
|
1103 my $active = Test::Nginx::HTTP2->new(port(8086)); |
995
35739834ecd9
Tests: fixed HTTP/2 GOAWAY test for connection with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
990
diff
changeset
|
1104 $sid = $active->new_stream({ path => '/t1.html' }); |
35739834ecd9
Tests: fixed HTTP/2 GOAWAY test for connection with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
990
diff
changeset
|
1105 $active->read(all => [{ sid => $sid, length => 2**16 - 1 }]); |
990
eb49d29d5447
Tests: redo 892737e9fd31 without flaky send_timeout adjustments.
Sergey Kandaurov <pluknet@nginx.com>
parents:
984
diff
changeset
|
1106 |
646 | 1107 $t->stop(); |
1108 | |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
1109 $frames = $s->read(all => [{ type => 'GOAWAY' }]); |
646 | 1110 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
984
892737e9fd31
Tests: added HTTP/2 GOAWAY test for connection with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
1111 ok($frame, 'GOAWAY on connection close - idle stream'); |
892737e9fd31
Tests: added HTTP/2 GOAWAY test for connection with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
1112 |
892737e9fd31
Tests: added HTTP/2 GOAWAY test for connection with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
1113 $frames = $active->read(all => [{ type => 'GOAWAY' }]); |
892737e9fd31
Tests: added HTTP/2 GOAWAY test for connection with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
1114 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
892737e9fd31
Tests: added HTTP/2 GOAWAY test for connection with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
1115 ok($frame, 'GOAWAY on connection close - active stream'); |
892737e9fd31
Tests: added HTTP/2 GOAWAY test for connection with active stream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
1116 |
646 | 1117 ############################################################################### |
1118 | |
647
4e36550410b3
Tests: h2.t fixes for older perl versions, and gzip test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
646
diff
changeset
|
1119 sub gunzip_like { |
4e36550410b3
Tests: h2.t fixes for older perl versions, and gzip test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
646
diff
changeset
|
1120 my ($in, $re, $name) = @_; |
646 | 1121 |
1122 SKIP: { | |
1123 eval { require IO::Uncompress::Gunzip; }; | |
1124 Test::More::skip( | |
1125 "IO::Uncompress::Gunzip not installed", 1) if $@; | |
1126 | |
1127 my $out; | |
1128 | |
1129 IO::Uncompress::Gunzip::gunzip(\$in => \$out); | |
1130 | |
647
4e36550410b3
Tests: h2.t fixes for older perl versions, and gzip test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
646
diff
changeset
|
1131 like($out, $re, $name); |
646 | 1132 } |
1133 } | |
1134 | |
1135 ############################################################################### |