comparison fastcgi_extra_data.t @ 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 463d6863d360
children 5ac6efbe5552
comparison
equal deleted inserted replaced
1585:bff287fbf347 1586:e145509cc6eb
25 eval { require FCGI; }; 25 eval { require FCGI; };
26 plan(skip_all => 'FCGI not installed') if $@; 26 plan(skip_all => 'FCGI not installed') if $@;
27 plan(skip_all => 'win32') if $^O eq 'MSWin32'; 27 plan(skip_all => 'win32') if $^O eq 'MSWin32';
28 28
29 my $t = Test::Nginx->new() 29 my $t = Test::Nginx->new()
30 ->has(qw/http fastcgi cache rewrite addition/)->plan(20) 30 ->has(qw/http fastcgi cache rewrite addition/)->plan(22)
31 ->write_file_expand('nginx.conf', <<'EOF'); 31 ->write_file_expand('nginx.conf', <<'EOF');
32 32
33 %%TEST_GLOBALS%% 33 %%TEST_GLOBALS%%
34 34
35 daemon off; 35 daemon off;
133 like(http_get('/head/short'), qr/SEE-THIS(?!.*:after)/s, 133 like(http_get('/head/short'), qr/SEE-THIS(?!.*:after)/s,
134 'head too short cached'); 134 'head too short cached');
135 135
136 } 136 }
137 137
138 # "zero size buf" alerts (ticket #2018)
139
140 TODO: {
141 local $TODO = 'not yet' unless $t->has_version('1.19.2');
142
143 like(http_get('/zero'), qr/200 OK(?!.*NOT-THIS)/s, 'zero size');
144 like(http_get('/unbuf/zero'), qr/200 OK(?!.*NOT-THIS)/s,
145 'unbuffered zero size');
146
147 }
148
149 $t->todo_alerts() unless $t->has_version('1.19.2')
150 or !$t->has_version('1.19.1');
151
138 ############################################################################### 152 ###############################################################################
139 153
140 sub fastcgi_daemon { 154 sub fastcgi_daemon {
141 my $socket = FCGI::OpenSocket('127.0.0.1:' . port(8081), 5); 155 my $socket = FCGI::OpenSocket('127.0.0.1:' . port(8081), 5);
142 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV, 156 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV,
153 if ($uri eq '/') { 167 if ($uri eq '/') {
154 print "Content-Type: text/html\n"; 168 print "Content-Type: text/html\n";
155 print "Content-Length: 8\n\n"; 169 print "Content-Length: 8\n\n";
156 print "SEE-THIS-BUT-NOT-THIS\n"; 170 print "SEE-THIS-BUT-NOT-THIS\n";
157 171
172 } elsif ($uri eq '/zero') {
173 print "Content-Type: text/html\n";
174 print "Content-Length: 0\n\n";
175 print "NOT-THIS\n";
176
158 } elsif ($uri eq '/short') { 177 } elsif ($uri eq '/short') {
159 print "Content-Type: text/html\n"; 178 print "Content-Type: text/html\n";
160 print "Content-Length: 100\n\n"; 179 print "Content-Length: 100\n\n";
161 print "SEE-THIS-TOO-SHORT-RESPONSE\n"; 180 print "SEE-THIS-TOO-SHORT-RESPONSE\n";
162 181