Mercurial > hg > nginx-tests
annotate h2_request_body.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 request body. |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
7 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
9 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
11 use strict; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
12 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
14 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
16 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
19 use Test::Nginx::HTTP2; |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
20 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
21 ############################################################################### |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
22 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
25 |
1728
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy/)->plan(49); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
27 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
28 $t->write_file_expand('nginx.conf', <<'EOF'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
29 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
30 %%TEST_GLOBALS%% |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
31 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
32 daemon off; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
33 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
34 events { |
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 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
37 http { |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
38 %%TEST_GLOBALS_HTTP%% |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
39 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
40 server { |
1986
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
41 listen 127.0.0.1:8080; |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
955
diff
changeset
|
42 listen 127.0.0.1:8081; |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
43 server_name localhost; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
44 |
1986
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
45 http2 on; |
1597
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
46 error_page 400 /proxy2/t.html; |
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
47 |
955
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
48 location / { |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
49 add_header X-Length $http_content_length; |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
50 } |
1226
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
51 location /slow { |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
52 limit_rate 100; |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
53 } |
1091
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
54 location /off/ { |
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
55 proxy_pass http://127.0.0.1:8081/; |
1226
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
56 add_header X-Body $request_body; |
1091
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
57 add_header X-Body-File $request_body_file; |
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
58 } |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
59 location /proxy2/ { |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
60 add_header X-Body $request_body; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
61 add_header X-Body-File $request_body_file; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
62 client_body_in_file_only on; |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
955
diff
changeset
|
63 proxy_pass http://127.0.0.1:8081/; |
876
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 location /client_max_body_size { |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
66 add_header X-Body $request_body; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
67 add_header X-Body-File $request_body_file; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
68 client_body_in_single_buffer on; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
69 client_body_in_file_only on; |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
955
diff
changeset
|
70 proxy_pass http://127.0.0.1:8081/; |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
71 client_max_body_size 10; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
72 } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
73 } |
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 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
76 EOF |
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 $t->write_file('index.html', ''); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
79 $t->write_file('t.html', 'SEE-THIS'); |
1226
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
80 $t->write_file('slow.html', 'SEE-THIS'); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
81 $t->run(); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
82 |
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 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
85 # request body (uses proxied response) |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
86 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
87 my $s = Test::Nginx::HTTP2->new(); |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
88 my $sid = $s->new_stream({ path => '/proxy2/t.html', body => 'TEST' }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
89 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
|
90 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
91 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
92 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST', 'request body'); |
955
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
93 is($frame->{headers}->{'x-length'}, 4, 'request body - content length'); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
94 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
95 # request body with padding (uses proxied response) |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
96 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
97 $s = Test::Nginx::HTTP2->new(); |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
98 $sid = $s->new_stream( |
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
99 { path => '/proxy2/t.html', body => 'TEST', body_padding => 42 }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
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 "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
103 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
104 'request body with padding'); |
955
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
105 is($frame->{headers}->{'x-length'}, 4, |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
106 'request body with padding - content length'); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
107 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
108 $sid = $s->new_stream(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
109 $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
|
110 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
111 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
112 is($frame->{headers}->{':status'}, '200', 'request body with padding - next'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
113 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
114 # request body sent in multiple DATA frames in a single packet |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
115 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
116 $s = Test::Nginx::HTTP2->new(); |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
117 $sid = $s->new_stream( |
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
118 { path => '/proxy2/t.html', body => 'TEST', body_split => [2] }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
119 $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
|
120 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
121 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
122 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
123 'request body in multiple frames'); |
955
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
124 is($frame->{headers}->{'x-length'}, 4, |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
125 'request body in multiple frames - content length'); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
126 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
127 # request body sent in multiple DATA frames, each in its own packet |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
128 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
129 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
130 $sid = $s->new_stream({ path => '/proxy2/t.html', body_more => 1 }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
131 $s->h2_body('TEST', { body_more => 1 }); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
132 select undef, undef, undef, 0.1; |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
133 $s->h2_body('MOREDATA'); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
134 $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
|
135 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
136 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
137 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTMOREDATA', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
138 'request body in multiple frames separately'); |
955
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
139 is($frame->{headers}->{'x-length'}, 12, |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
140 'request body in multiple frames separately - content length'); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
141 |
1728
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
142 # if run with body buffering in filters, it's expected to update window |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
143 # after request body populates initial stream window size set for preread |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
144 |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
145 $s = Test::Nginx::HTTP2->new(); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
146 $sid = $s->new_stream({ path => '/proxy2/t.html', body_more => 1 }); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
147 $s->h2_body('01234567' x 2048, { body_more => 1 }); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
148 select undef, undef, undef, 0.1; |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
149 $s->h2_body('01234567' x 2048, { body_more => 1 }); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
150 select undef, undef, undef, 0.1; |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
151 $s->h2_body('01234567' x 2048, { body_more => 1 }); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
152 select undef, undef, undef, 0.1; |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
153 $s->h2_body('01234567' x 2048, { body_more => 1 }); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
154 |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
155 $frames = $s->read(all => [{ type => 'WINDOW_UPDATE' }]); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
156 ($frame) = grep { $_->{type} eq 'WINDOW_UPDATE' } @$frames; |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
157 is($frame->{sid}, $sid, 'big request body - WINDOW_UPDATE sid'); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
158 cmp_ok($frame->{wdelta}, '>=', 65536, 'big request body - WINDOW_UPDATE delta'); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
159 |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
160 $s->h2_body('01234567' x 2048); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
161 |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
162 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
163 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
164 is(read_body_file($frame->{headers}->{'x-body-file'}), '01234567' x 10240, |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
165 'big request body - content'); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
166 is($frame->{headers}->{'x-length'}, 81920, |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
167 'big request body - content length'); |
6d5ecf445e57
Tests: added HTTP/2 test with big request body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1721
diff
changeset
|
168 |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
169 # request body with an empty DATA frame |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
170 # "zero size buf in output" alerts seen |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
171 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
172 $s = Test::Nginx::HTTP2->new(); |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
173 $sid = $s->new_stream({ path => '/proxy2/', body => '' }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
174 $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
|
175 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
176 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
177 is($frame->{headers}->{':status'}, 200, 'request body - empty'); |
955
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
178 is($frame->{headers}->{'x-length'}, 0, 'request body - empty size'); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
179 ok($frame->{headers}{'x-body-file'}, 'request body - empty body file'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
180 is(read_body_file($frame->{headers}{'x-body-file'}), '', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
181 'request body - empty content'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
182 |
955
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
183 # it is expected to avoid adding Content-Length for requests without body |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
184 |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
185 $s = Test::Nginx::HTTP2->new(); |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
186 $sid = $s->new_stream({ path => '/proxy2/' }); |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
187 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
188 |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
189 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
190 is($frame->{headers}->{':status'}, 200, 'request without body'); |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
191 is($frame->{headers}->{'x-length'}, undef, |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
192 'request without body - content length'); |
b8948aecba12
Tests: HTTP/2 request body Content-Length tests in proxied request.
Sergey Kandaurov <pluknet@nginx.com>
parents:
952
diff
changeset
|
193 |
888
4ab795ab2e62
Tests: added HTTP/2 test for zero RST_STREAM if discarding body.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
886
diff
changeset
|
194 # request body discarded |
4ab795ab2e62
Tests: added HTTP/2 test for zero RST_STREAM if discarding body.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
886
diff
changeset
|
195 # RST_STREAM with zero code received |
4ab795ab2e62
Tests: added HTTP/2 test for zero RST_STREAM if discarding body.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
886
diff
changeset
|
196 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
197 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
198 $sid = $s->new_stream({ body_more => 1 }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
199 $frames = $s->read(all => [{ type => 'RST_STREAM' }], wait => 0.5); |
888
4ab795ab2e62
Tests: added HTTP/2 test for zero RST_STREAM if discarding body.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
886
diff
changeset
|
200 |
4ab795ab2e62
Tests: added HTTP/2 test for zero RST_STREAM if discarding body.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
886
diff
changeset
|
201 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; |
4ab795ab2e62
Tests: added HTTP/2 test for zero RST_STREAM if discarding body.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
886
diff
changeset
|
202 is($frame->{code}, 0, 'request body discarded - zero RST_STREAM'); |
4ab795ab2e62
Tests: added HTTP/2 test for zero RST_STREAM if discarding body.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
886
diff
changeset
|
203 |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
204 # malformed request body length not equal to content-length |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
205 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
206 $s = Test::Nginx::HTTP2->new(); |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
207 $sid = $s->new_stream({ body => 'TEST', headers => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
208 { name => ':method', value => 'GET', mode => 0 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
209 { name => ':scheme', value => 'http', mode => 0 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
210 { name => ':path', value => '/client_max_body_size', mode => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
211 { name => ':authority', value => 'localhost', mode => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
212 { name => 'content-length', value => '5', mode => 1 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
213 $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
|
214 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
215 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
216 is($frame->{headers}->{':status'}, 400, 'request body less than content-length'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
217 |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
218 $sid = $s->new_stream({ body => 'TEST', headers => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
219 { name => ':method', value => 'GET', mode => 0 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
220 { name => ':scheme', value => 'http', mode => 0 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
221 { name => ':path', value => '/client_max_body_size', mode => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
222 { name => ':authority', value => 'localhost', mode => 1 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
223 { name => 'content-length', value => '3', mode => 1 }]}); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
224 $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
|
225 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
226 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
227 is($frame->{headers}->{':status'}, 400, 'request body more than content-length'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
228 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
229 # client_max_body_size |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
230 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
231 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
232 $sid = $s->new_stream({ path => '/client_max_body_size/t.html', |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
233 body => 'TESTTEST12' }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
234 $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
|
235 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
236 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
237 is($frame->{headers}->{':status'}, 200, 'client_max_body_size - status'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
238 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
239 'client_max_body_size - body'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
240 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
241 # client_max_body_size - limited |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
242 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
243 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
244 $sid = $s->new_stream({ path => '/client_max_body_size/t.html', |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
245 body => 'TESTTEST123' }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
246 $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
|
247 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
248 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
249 is($frame->{headers}->{':status'}, 413, 'client_max_body_size - limited'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
250 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
251 # client_max_body_size - many DATA frames |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
252 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
253 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
254 $sid = $s->new_stream({ path => '/client_max_body_size/t.html', |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
255 body => 'TESTTEST12', body_split => [2] }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
256 $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
|
257 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
258 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
259 is($frame->{headers}->{':status'}, 200, 'client_max_body_size many - status'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
260 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
261 'client_max_body_size many - body'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
262 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
263 # client_max_body_size - many DATA frames - limited |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
264 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
265 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
266 $sid = $s->new_stream({ path => '/client_max_body_size/t.html', |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
267 body => 'TESTTEST123', body_split => [2] }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
268 $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
|
269 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
270 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
271 is($frame->{headers}->{':status'}, 413, 'client_max_body_size many - limited'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
272 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
273 # client_max_body_size - padded DATA |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
274 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
275 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
276 $sid = $s->new_stream({ path => '/client_max_body_size/t.html', |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
277 body => 'TESTTEST12', body_padding => 42 }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
278 $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
|
279 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
280 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
281 is($frame->{headers}->{':status'}, 200, 'client_max_body_size pad - status'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
282 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
283 'client_max_body_size pad - body'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
284 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
285 # client_max_body_size - padded DATA - limited |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
286 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
287 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
288 $sid = $s->new_stream({ path => '/client_max_body_size/t.html', |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
289 body => 'TESTTEST123', body_padding => 42 }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
290 $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
|
291 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
292 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
293 is($frame->{headers}->{':status'}, 413, 'client_max_body_size pad - limited'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
294 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
295 # client_max_body_size - many padded DATA frames |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
296 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
297 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
298 $sid = $s->new_stream({ path => '/client_max_body_size/t.html', |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
299 body => 'TESTTEST12', body_padding => 42, body_split => [2] }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
300 $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
|
301 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
302 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
303 is($frame->{headers}->{':status'}, 200, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
304 'client_max_body_size many pad - status'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
305 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
306 'client_max_body_size many pad - body'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
307 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
308 # client_max_body_size - many padded DATA frames - limited |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
309 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
310 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
311 $sid = $s->new_stream({ path => '/client_max_body_size/t.html', |
1721
6842b0f7fb9e
Tests: restored HTTP/2 request body tests with Content-Length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
312 body => 'TESTTEST123', body_padding => 42, body_split => [2] }); |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
313 $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
|
314 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
315 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
316 is($frame->{headers}->{':status'}, 413, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
317 'client_max_body_size many pad - limited'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
318 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
319 # request body without content-length |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
320 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
321 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
322 $sid = $s->new_stream({ body_more => 1, headers => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
323 { name => ':method', value => 'GET', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
324 { name => ':scheme', value => 'http', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
325 { name => ':path', value => '/client_max_body_size', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
326 { 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
|
327 $s->h2_body('TESTTEST12'); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
328 $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
|
329 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
330 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
331 is($frame->{headers}->{':status'}, 200, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
332 'request body without content-length - status'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
333 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
334 'request body without content-length - body'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
335 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
336 # request body without content-length - limited |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
337 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
338 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
339 $sid = $s->new_stream({ body_more => 1, headers => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
340 { name => ':method', value => 'GET', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
341 { name => ':scheme', value => 'http', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
342 { name => ':path', value => '/client_max_body_size', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
343 { 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
|
344 $s->h2_body('TESTTEST123'); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
345 $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
|
346 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
347 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
348 is($frame->{headers}->{':status'}, 413, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
349 'request body without content-length - limited'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
350 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
351 # request body without content-length - many DATA frames |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
352 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
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({ body_more => 1, headers => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
355 { name => ':method', value => 'GET', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
356 { name => ':scheme', value => 'http', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
357 { name => ':path', value => '/client_max_body_size', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
358 { 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
|
359 $s->h2_body('TESTTEST12', { body_split => [2] }); |
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 }]); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
361 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
362 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
363 is($frame->{headers}->{':status'}, 200, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
364 'request body without content-length many - status'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
365 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
366 'request body without content-length many - body'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
367 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
368 # request body without content-length - many DATA frames - limited |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
369 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
370 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
371 $sid = $s->new_stream({ body_more => 1, headers => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
372 { name => ':method', value => 'GET', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
373 { name => ':scheme', value => 'http', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
374 { name => ':path', value => '/client_max_body_size', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
375 { 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
|
376 $s->h2_body('TESTTEST123', { body_split => [2] }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
377 $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
|
378 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
379 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
380 is($frame->{headers}->{':status'}, 413, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
381 'request body without content-length many - limited'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
382 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
383 # request body without content-length - padding |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
384 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
385 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
386 $sid = $s->new_stream({ body_more => 1, headers => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
387 { name => ':method', value => 'GET', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
388 { name => ':scheme', value => 'http', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
389 { name => ':path', value => '/client_max_body_size', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
390 { 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
|
391 $s->h2_body('TESTTEST12', { body_padding => 42 }); |
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 }]); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
393 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
394 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
395 is($frame->{headers}->{':status'}, 200, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
396 'request body without content-length pad - status'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
397 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
398 'request body without content-length pad - body'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
399 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
400 # request body without content-length - padding - limited |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
401 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
402 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
403 $sid = $s->new_stream({ body_more => 1, headers => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
404 { name => ':method', value => 'GET', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
405 { name => ':scheme', value => 'http', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
406 { name => ':path', value => '/client_max_body_size', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
407 { 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
|
408 $s->h2_body('TESTTEST123', { body_padding => 42 }); |
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 }]); |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
410 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
411 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
412 is($frame->{headers}->{':status'}, 413, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
413 'request body without content-length pad - limited'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
414 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
415 # request body without content-length - padding with many DATA frames |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
416 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
417 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
418 $sid = $s->new_stream({ body_more => 1, headers => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
419 { name => ':method', value => 'GET', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
420 { name => ':scheme', value => 'http', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
421 { name => ':path', value => '/client_max_body_size', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
422 { 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
|
423 $s->h2_body('TESTTEST', { body_padding => 42, body_split => [2] }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
424 $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
|
425 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
426 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
427 is($frame->{headers}->{':status'}, 200, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
428 'request body without content-length many pad - status'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
429 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST', |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
430 'request body without content-length many pad - body'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
431 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
432 # request body without content-length - padding with many DATA frames - limited |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
433 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
434 $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
435 $sid = $s->new_stream({ body_more => 1, headers => [ |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
436 { name => ':method', value => 'GET', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
437 { name => ':scheme', value => 'http', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
438 { name => ':path', value => '/client_max_body_size', mode => 2 }, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
439 { 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
|
440 $s->h2_body('TESTTEST123', { body_padding => 42, body_split => [2] }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
945
diff
changeset
|
441 $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
|
442 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
443 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
444 is($frame->{headers}->{':status'}, 413, |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
445 'request body without content-length many pad - limited'); |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
446 |
1091
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
447 # absent request body is not buffered with client_body_in_file_only off |
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
448 # see e02f1977846b for details |
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
449 |
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
450 $s = Test::Nginx::HTTP2->new(); |
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
451 $sid = $s->new_stream({ path => '/off/t.html' }); |
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
452 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
453 |
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
454 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
455 is($frame->{headers}->{'x-body-file'}, undef, 'no request body in file'); |
a5e428f4440d
Tests: added request body buffering test for requests without body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1070
diff
changeset
|
456 |
1226
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
457 # ticket #1384, request body corruption in recv_buffer |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
458 |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
459 $s = Test::Nginx::HTTP2->new(); |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
460 $sid = $s->new_stream({ path => '/off/slow.html', body_more => 1 }); |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
461 select undef, undef, undef, 0.1; |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
462 |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
463 # for simplicity, DATA frame is received on its own for a known offset |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
464 |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
465 $s->h2_body('TEST'); |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
466 select undef, undef, undef, 0.1; |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
467 |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
468 # overwrite recv_buffer; since upstream response arrival is delayed, |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
469 # this would make $request_body point to the overridden buffer space |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
470 |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
471 $s->h2_ping('xxxx'); |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
472 |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
473 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
474 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
475 isnt($frame->{headers}->{'x-body'}, 'xxxx', 'sync buffer'); |
124322e9accd
Tests: HTTP/2 request body sync buffer test added (ticket #1384).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1091
diff
changeset
|
476 |
1597
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
477 # request body after 400 errors redirected to a proxied location |
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
478 |
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
479 $s = Test::Nginx::HTTP2->new(); |
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
480 $sid = $s->new_stream({ body => "", headers => [ |
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
481 { name => ':method', value => "" }]}); |
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
482 |
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
483 $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
484 ($frame) = grep { $_->{type} eq 'DATA' } @$frames; |
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
485 is($frame->{data}, 'SEE-THIS', 'request body after 400 redirect'); |
36d69685605e
Tests: added HTTP/2 tests for DATA frames after 400 errors.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1511
diff
changeset
|
486 |
876
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
487 ############################################################################### |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
488 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
489 sub read_body_file { |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
490 my ($path) = @_; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
491 open FILE, $path or return "$!"; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
492 local $/; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
493 my $content = <FILE>; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
494 close FILE; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
495 return $content; |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
496 } |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
497 |
a6abbfed42c0
Tests: split HTTP/2 tests, HTTP2 package introduced.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
498 ############################################################################### |