changeset 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 6842b0f7fb9e
children 3581dc3c1937
files body_chunked.t
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/body_chunked.t
+++ b/body_chunked.t
@@ -22,7 +22,7 @@ use Test::Nginx;
 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 @@ like(http_transfer_encoding("chunked\nCo
 
 }
 
+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_get_body {
 }
 
 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