# HG changeset patch # User Sergey Kandaurov # Date 1628521988 -10800 # Node ID 122002b1941616456acc3fa3c0c4550b963b192e # Parent 6842b0f7fb9e381900670f42d21b33f64e61796c Tests: HTTP/1.0 requests with Transfer-Encoding. diff -r 6842b0f7fb9e -r 122002b19416 body_chunked.t --- a/body_chunked.t Tue Jul 20 16:12:54 2021 +0300 +++ b/body_chunked.t Mon Aug 09 18:13:08 2021 +0300 @@ -22,7 +22,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(17); +my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(18); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -186,6 +186,14 @@ } +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.21.2'); + +like(http_transfer_encoding("chunked", "1.0"), qr/400 Bad/, + 'transfer encoding in HTTP/1.0 requests'); + +} + ############################################################################### sub read_body_file { @@ -222,9 +230,10 @@ } sub http_transfer_encoding { - my ($encoding) = @_; + my ($encoding, $version) = @_; + $version ||= "1.1"; - http("GET / HTTP/1.1" . CRLF + http("GET / HTTP/$version" . CRLF . "Host: localhost" . CRLF . "Connection: close" . CRLF . "Transfer-Encoding: $encoding" . CRLF . CRLF