Tests: tests for "zero size buf" alerts in unbuffered proxying.

Starting with nginx 1.19.1, non-buffered simple proxying of responses
with expected length 0 but some extra data might result in zero size
buffers being generated and "zero size buf" alerts in writer (ticket #2117).
Tests for a similar bug in FastCGI proxying are in 1586:e145509cc6eb.
diff --git a/proxy_extra_data.t b/proxy_extra_data.t
index 22cb824..9d7b78e 100644
--- a/proxy_extra_data.t
+++ b/proxy_extra_data.t
@@ -23,7 +23,7 @@
 select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()
-	->has(qw/http proxy cache rewrite addition/)->plan(20)
+	->has(qw/http proxy cache rewrite addition/)->plan(22)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -131,6 +131,26 @@
 like(http_get('/head/short'), qr/SEE-THIS(?!.*:after)/s,
 	'head too short cached');
 
+
+# "zero size buf" alerts (ticket #2117)
+
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.19.1');
+
+like(http_get('/zero'), qr/200 OK(?!.*NOT-THIS)/s, 'zero size');
+
+}
+
+TODO: {
+local $TODO = 'not yet';
+
+like(http_get('/unbuf/zero'), qr/200 OK(?!.*NOT-THIS)/s,
+	'unbuffered zero size');
+
+}
+
+$t->todo_alerts() if $t->has_version('1.19.1');
+
 ###############################################################################
 
 sub http_daemon {
@@ -168,6 +188,12 @@
 			$c->print("Content-Length: 8\n\n");
 			$c->print("SEE-THIS-BUT-NOT-THIS\n");
 
+		} elsif ($uri eq '/zero') {
+			$c->print("HTTP/1.1 200 OK\n");
+			$c->print("Content-Type: text/html\n");
+			$c->print("Content-Length: 0\n\n");
+			$c->print("NOT-THIS\n");
+
 		} elsif ($uri eq '/short') {
 			$c->print("HTTP/1.1 200 OK\n");
 			$c->print("Content-Type: text/html\n");
diff --git a/scgi_extra_data.t b/scgi_extra_data.t
index edecb7d..d954f92 100644
--- a/scgi_extra_data.t
+++ b/scgi_extra_data.t
@@ -26,7 +26,7 @@
 plan(skip_all => 'SCGI not installed') if $@;
 
 my $t = Test::Nginx->new()
-	->has(qw/http scgi cache rewrite addition/)->plan(20)
+	->has(qw/http scgi cache rewrite addition/)->plan(22)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -135,6 +135,25 @@
 
 }
 
+# "zero size buf" alerts (ticket #2117)
+
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.19.1');
+
+like(http_get('/zero'), qr/200 OK(?!.*NOT-THIS)/s, 'zero size');
+
+}
+
+TODO: {
+local $TODO = 'not yet';
+
+like(http_get('/unbuf/zero'), qr/200 OK(?!.*NOT-THIS)/s,
+	'unbuffered zero size');
+
+}
+
+$t->todo_alerts() if $t->has_version('1.19.1');
+
 ###############################################################################
 
 sub scgi_daemon {
@@ -165,6 +184,11 @@
 			$c->print("Content-Length: 8\n\n");
 			$c->print("SEE-THIS-BUT-NOT-THIS\n");
 
+		} elsif ($uri eq '/zero') {
+			$c->print("Content-Type: text/html\n");
+			$c->print("Content-Length: 0\n\n");
+			$c->print("NOT-THIS\n");
+
 		} elsif ($uri eq '/short') {
 			$c->print("Content-Type: text/html\n");
 			$c->print("Content-Length: 100\n\n");