comparison body_chunked.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 91235919d80f
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(10); 25 my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(11);
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
62 } 62 }
63 location /single { 63 location /single {
64 client_body_in_single_buffer on; 64 client_body_in_single_buffer on;
65 add_header X-Body "$request_body"; 65 add_header X-Body "$request_body";
66 add_header X-Body-File "$request_body_file"; 66 add_header X-Body-File "$request_body_file";
67 proxy_pass http://127.0.0.1:8081;
68 }
69 location /large {
70 client_max_body_size 1k;
67 proxy_pass http://127.0.0.1:8081; 71 proxy_pass http://127.0.0.1:8081;
68 } 72 }
69 location /discard { 73 location /discard {
70 return 200 "TEST\n"; 74 return 200 "TEST\n";
71 } 75 }
111 like(read_body_file(http_get_body('/b', '0123456789' x 512)), 115 like(read_body_file(http_get_body('/b', '0123456789' x 512)),
112 qr/^(0123456789){512}$/s, 'body in file only'); 116 qr/^(0123456789){512}$/s, 'body in file only');
113 117
114 like(http_get_body('/single', '0123456789' x 128), 118 like(http_get_body('/single', '0123456789' x 128),
115 qr/X-Body: (0123456789){128}\x0d?$/ms, 'body in single buffer'); 119 qr/X-Body: (0123456789){128}\x0d?$/ms, 'body in single buffer');
120
121 like(http_get_body('/large', '0123456789' x 128), qr/ 413 /, 'body too large');
116 122
117 # pipelined requests 123 # pipelined requests
118 124
119 like(http_get_body('/', '0123456789', '0123456789' x 128, '0123456789' x 512, 125 like(http_get_body('/', '0123456789', '0123456789' x 128, '0123456789' x 512,
120 'foobar'), qr/X-Body: foobar\x0d?$/ms, 'chunked body pipelined'); 126 'foobar'), qr/X-Body: foobar\x0d?$/ms, 'chunked body pipelined');