Mercurial > hg > nginx-tests
comparison body_chunked.t @ 1722:122002b19416
Tests: HTTP/1.0 requests with Transfer-Encoding.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 09 Aug 2021 18:13:08 +0300 |
parents | 6c03c329ed95 |
children | 2a0a6035a1af |
comparison
equal
deleted
inserted
replaced
1721:6842b0f7fb9e | 1722:122002b19416 |
---|---|
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(17); | 25 my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(18); |
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 |
181 TODO: { | 181 TODO: { |
182 local $TODO = 'not yet' unless $t->has_version('1.21.1'); | 182 local $TODO = 'not yet' unless $t->has_version('1.21.1'); |
183 | 183 |
184 like(http_transfer_encoding("chunked\nContent-Length: 5"), qr/400 Bad/, | 184 like(http_transfer_encoding("chunked\nContent-Length: 5"), qr/400 Bad/, |
185 'transfer encoding with content-length'); | 185 'transfer encoding with content-length'); |
186 | |
187 } | |
188 | |
189 TODO: { | |
190 local $TODO = 'not yet' unless $t->has_version('1.21.2'); | |
191 | |
192 like(http_transfer_encoding("chunked", "1.0"), qr/400 Bad/, | |
193 'transfer encoding in HTTP/1.0 requests'); | |
186 | 194 |
187 } | 195 } |
188 | 196 |
189 ############################################################################### | 197 ############################################################################### |
190 | 198 |
220 . "0" . CRLF . CRLF | 228 . "0" . CRLF . CRLF |
221 ); | 229 ); |
222 } | 230 } |
223 | 231 |
224 sub http_transfer_encoding { | 232 sub http_transfer_encoding { |
225 my ($encoding) = @_; | 233 my ($encoding, $version) = @_; |
226 | 234 $version ||= "1.1"; |
227 http("GET / HTTP/1.1" . CRLF | 235 |
236 http("GET / HTTP/$version" . CRLF | |
228 . "Host: localhost" . CRLF | 237 . "Host: localhost" . CRLF |
229 . "Connection: close" . CRLF | 238 . "Connection: close" . CRLF |
230 . "Transfer-Encoding: $encoding" . CRLF . CRLF | 239 . "Transfer-Encoding: $encoding" . CRLF . CRLF |
231 . "0" . CRLF . CRLF); | 240 . "0" . CRLF . CRLF); |
232 } | 241 } |