comparison body.t @ 1500:44ce08f5259f

Tests: client_max_body_size tests in body.t, body_chunked.t. HTTP/2 client_max_body_size tests were committed in 762:f28debc81182.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 22 Aug 2019 14:02:14 +0300
parents 882267679006
children 57a92c20f974
comparison
equal deleted inserted replaced
1499:c9d7e2a26b2d 1500:44ce08f5259f
20 ############################################################################### 20 ###############################################################################
21 21
22 select STDERR; $| = 1; 22 select STDERR; $| = 1;
23 select STDOUT; $| = 1; 23 select STDOUT; $| = 1;
24 24
25 my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(13); 25 my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(14);
26 26
27 $t->write_file_expand('nginx.conf', <<'EOF'); 27 $t->write_file_expand('nginx.conf', <<'EOF');
28 28
29 %%TEST_GLOBALS%% 29 %%TEST_GLOBALS%%
30 30
67 } 67 }
68 location /single { 68 location /single {
69 client_body_in_single_buffer on; 69 client_body_in_single_buffer on;
70 add_header X-Body "$request_body"; 70 add_header X-Body "$request_body";
71 add_header X-Body-File "$request_body_file"; 71 add_header X-Body-File "$request_body_file";
72 proxy_pass http://127.0.0.1:8081;
73 }
74 location /large {
75 client_max_body_size 1k;
72 proxy_pass http://127.0.0.1:8081; 76 proxy_pass http://127.0.0.1:8081;
73 } 77 }
74 location /discard { 78 location /discard {
75 return 200 "TEST\n"; 79 return 200 "TEST\n";
76 } 80 }
118 like(read_body_file(http_get_body('/b', '0123456789' x 512)), 122 like(read_body_file(http_get_body('/b', '0123456789' x 512)),
119 qr/^(0123456789){512}$/s, 'body in file only'); 123 qr/^(0123456789){512}$/s, 'body in file only');
120 124
121 like(http_get_body('/single', '0123456789' x 128), 125 like(http_get_body('/single', '0123456789' x 128),
122 qr/X-Body: (0123456789){128}\x0d?$/ms, 'body in single buffer'); 126 qr/X-Body: (0123456789){128}\x0d?$/ms, 'body in single buffer');
127
128 like(http_get_body('/large', '0123456789' x 128), qr/ 413 /, 'body too large');
123 129
124 # pipelined requests 130 # pipelined requests
125 131
126 like(http_get_body('/', '0123456789', '0123456789' x 128, '0123456789' x 512, 132 like(http_get_body('/', '0123456789', '0123456789' x 128, '0123456789' x 512,
127 'foobar'), qr/X-Body: foobar\x0d?$/ms, 'body pipelined'); 133 'foobar'), qr/X-Body: foobar\x0d?$/ms, 'body pipelined');