changeset 1586:e145509cc6eb

Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 27 Jul 2020 21:19:20 +0300
parents bff287fbf347
children 17b227c271a2
files fastcgi_extra_data.t
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/fastcgi_extra_data.t
+++ b/fastcgi_extra_data.t
@@ -27,7 +27,7 @@ plan(skip_all => 'FCGI not installed') i
 plan(skip_all => 'win32') if $^O eq 'MSWin32';
 
 my $t = Test::Nginx->new()
-	->has(qw/http fastcgi cache rewrite addition/)->plan(20)
+	->has(qw/http fastcgi cache rewrite addition/)->plan(22)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -135,6 +135,20 @@ like(http_get('/head/short'), qr/SEE-THI
 
 }
 
+# "zero size buf" alerts (ticket #2018)
+
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.19.2');
+
+like(http_get('/zero'), qr/200 OK(?!.*NOT-THIS)/s, 'zero size');
+like(http_get('/unbuf/zero'), qr/200 OK(?!.*NOT-THIS)/s,
+	'unbuffered zero size');
+
+}
+
+$t->todo_alerts() unless $t->has_version('1.19.2')
+	or !$t->has_version('1.19.1');
+
 ###############################################################################
 
 sub fastcgi_daemon {
@@ -155,6 +169,11 @@ sub fastcgi_daemon {
 			print "Content-Length: 8\n\n";
 			print "SEE-THIS-BUT-NOT-THIS\n";
 
+		} elsif ($uri eq '/zero') {
+			print "Content-Type: text/html\n";
+			print "Content-Length: 0\n\n";
+			print "NOT-THIS\n";
+
 		} elsif ($uri eq '/short') {
 			print "Content-Type: text/html\n";
 			print "Content-Length: 100\n\n";