Mercurial > hg > nginx-tests
annotate h2_variables.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | 11463d379570 |
children |
rev | line source |
---|---|
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
2 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
5 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
6 # Tests for HTTP/2 protocol with variables. |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
7 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
9 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
11 use strict; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
12 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
14 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
16 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
19 use Test::Nginx::HTTP2; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
20 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
21 ############################################################################### |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
22 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
25 |
1286
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http http_v2 rewrite/)->plan(6) |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
27 ->write_file_expand('nginx.conf', <<'EOF'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
28 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
29 %%TEST_GLOBALS%% |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
30 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
31 daemon off; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
32 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
33 events { |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
34 } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
35 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
36 http { |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
37 %%TEST_GLOBALS_HTTP%% |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
38 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
39 server { |
1986
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
40 listen 127.0.0.1:8080; |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
41 server_name localhost; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
42 |
1986
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
43 http2 on; |
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
44 |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
45 location /h2 { |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
46 return 200 $http2; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
47 } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
48 location /sp { |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
49 return 200 $server_protocol; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
50 } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
51 location /scheme { |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
52 return 200 $scheme; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
53 } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
54 location /https { |
1297
a94a0fc60d56
Tests: avoid empty DATA frame in h2_variables.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1286
diff
changeset
|
55 return 200 "body $https"; |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
56 } |
1286
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
57 location /rl { |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
58 return 200 $request_length; |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
59 } |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
60 } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
61 } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
62 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
63 EOF |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
64 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
65 $t->run(); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
66 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
67 ############################################################################### |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
68 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
69 # $http2 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
70 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
71 my $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
72 my $sid = $s->new_stream({ path => '/h2' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
73 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
74 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
75 my ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
76 is($frame->{data}, 'h2c', 'http variable - h2c'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
77 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
78 # $server_protocol |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
79 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
80 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
81 $sid = $s->new_stream({ path => '/sp' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
82 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
83 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
84 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
85 is($frame->{data}, 'HTTP/2.0', 'server_protocol variable'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
86 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
87 # $scheme |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
88 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
89 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
90 $sid = $s->new_stream({ path => '/scheme' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
91 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
92 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
93 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
94 is($frame->{data}, 'http', 'scheme variable'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
95 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
96 # $https |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
97 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
98 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
99 $sid = $s->new_stream({ path => '/https' }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
876
diff
changeset
|
100 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
101 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
102 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
1297
a94a0fc60d56
Tests: avoid empty DATA frame in h2_variables.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1286
diff
changeset
|
103 is($frame->{data}, 'body ', 'https variable'); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
104 |
1286
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
105 # $request_length, HEADERS payload length |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
106 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
107 $s = Test::Nginx::HTTP2->new(); |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
108 $sid = $s->new_stream({ headers => [ |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
109 { name => ':method', value => 'GET', mode => 0 }, # 1 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
110 { name => ':scheme', value => 'http', mode => 0 }, # 1 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
111 { name => ':authority', value => 'localhost', mode => 1 }, # 1+1+9 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
112 { name => ':path', value => '/rl', mode => 1 }]}); # 1+1+3 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
113 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
114 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
115 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
116 is($frame->{data}, '18', 'request length'); |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
117 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
118 # $request_length, HEADERS+CONTINUATION payload length |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
119 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
120 $s = Test::Nginx::HTTP2->new(); |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
121 $sid = $s->new_stream({ continuation => 1, headers => [ |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
122 { name => ':method', value => 'GET', mode => 0 }, # 1 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
123 { name => ':authority', value => 'localhost', mode => 1 }, # 1+1+9 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
124 { name => ':path', value => '/rl', mode => 1 }]}); # 1+1+3 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
125 $s->h2_continue($sid, { headers => [ |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
126 { name => ':scheme', value => 'http', mode => 0 }]}); # 1 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
127 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
128 |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
129 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
130 is($frame->{data}, '18', 'request length'); |
b50c8b9a7644
Tests: added HTTP/2 $request_length tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
131 |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
132 ############################################################################### |