Mercurial > hg > nginx-tests
changeset 1501:91235919d80f
Tests: request body and invalid chunked transfer encoding.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 03 Sep 2019 18:50:56 +0300 |
parents | 44ce08f5259f |
children | 5ae8e8feac36 |
files | body_chunked.t |
diffstat | 1 files changed, 34 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/body_chunked.t Thu Aug 22 14:02:14 2019 +0300 +++ b/body_chunked.t Tue Sep 03 18:50:56 2019 +0300 @@ -22,7 +22,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(11); +my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(13); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -134,6 +134,39 @@ '0123456789', 'foobar'), qr/(TEST.*){4}/ms, 'chunked body discard 2'); +# invalid chunks + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.17.4'); + +like( + http( + 'GET / HTTP/1.1' . CRLF + . 'Host: localhost' . CRLF + . 'Connection: close' . CRLF + . 'Transfer-Encoding: chunked' . CRLF . CRLF + . '4' . CRLF + . 'SEE-THIS' . CRLF + . '0' . CRLF . CRLF + ), + qr/400 Bad/, 'runaway chunk' +); + +unlike( + http( + 'GET /discard HTTP/1.1' . CRLF + . 'Host: localhost' . CRLF + . 'Connection: close' . CRLF + . 'Transfer-Encoding: chunked' . CRLF . CRLF + . '4' . CRLF + . 'SEE-THIS' . CRLF + . '0' . CRLF . CRLF + ), + qr/200 OK/, 'runaway chunk discard' +); + +} + # proxy_next_upstream like(http_get_body('/next', '0123456789'),