Mercurial > hg > nginx-tests
comparison body.t @ 1539:57a92c20f974
Tests: discarded request body in error_page redirect.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 27 Dec 2019 11:59:19 +0300 |
parents | 44ce08f5259f |
children | 5ac6efbe5552 |
comparison
equal
deleted
inserted
replaced
1538:c49e5ca1d840 | 1539:57a92c20f974 |
---|---|
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(14); | 25 my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(15); |
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 |
78 location /discard { | 78 location /discard { |
79 return 200 "TEST\n"; | 79 return 200 "TEST\n"; |
80 } | 80 } |
81 location /next { | 81 location /next { |
82 proxy_pass http://u/; | 82 proxy_pass http://u/; |
83 } | |
84 location /redirect { | |
85 error_page 404 http://example.com/; | |
83 } | 86 } |
84 } | 87 } |
85 | 88 |
86 server { | 89 server { |
87 listen 127.0.0.1:8081; | 90 listen 127.0.0.1:8081; |
162 | 165 |
163 # proxy_next_upstream | 166 # proxy_next_upstream |
164 | 167 |
165 like(http_get_body('/next', '0123456789'), | 168 like(http_get_body('/next', '0123456789'), |
166 qr/X-Body: 0123456789\x0d?$/ms, 'body next upstream'); | 169 qr/X-Body: 0123456789\x0d?$/ms, 'body next upstream'); |
170 | |
171 # discarded request body in redirect via error_page | |
172 | |
173 TODO: { | |
174 local $TODO = 'not yet' unless $t->has_version('1.17.7'); | |
175 | |
176 unlike( | |
177 http( | |
178 'POST /redirect HTTP/1.1' . CRLF | |
179 . 'Host: localhost' . CRLF | |
180 . 'Content-Length: 10' . CRLF . CRLF | |
181 . '0123456789' . | |
182 'GET /next HTTP/1.0' . CRLF . CRLF | |
183 ), | |
184 qr/400 Bad Request/ms, 'redirect - discard request body' | |
185 ); | |
186 | |
187 } | |
167 | 188 |
168 ############################################################################### | 189 ############################################################################### |
169 | 190 |
170 sub read_body_file { | 191 sub read_body_file { |
171 my ($r) = @_; | 192 my ($r) = @_; |