comparison fastcgi_request_buffering_chunked.t @ 837:68a6678abae2

Tests: improved logging for unbuffered request body tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 29 Jan 2016 16:12:42 +0300
parents 907e89fba9c3
children 6bb1f2ccd386
comparison
equal deleted inserted replaced
836:a9c4cebcfe69 837:68a6678abae2
268 local $SIG{PIPE} = sub { die "sigpipe\n" }; 268 local $SIG{PIPE} = sub { die "sigpipe\n" };
269 alarm(5); 269 alarm(5);
270 270
271 $client = $server->accept(); 271 $client = $server->accept();
272 272
273 log2c("(new connection $client)");
274
273 alarm(0); 275 alarm(0);
274 }; 276 };
275 alarm(0); 277 alarm(0);
276 if ($@) { 278 if ($@) {
277 log_in("died: $@"); 279 log_in("died: $@");
278 return undef; 280 return undef;
279 } 281 }
280 282
281 $client->sysread(my $buf, 1024); 283 $client->sysread(my $buf, 1024);
284 log2i($buf);
285
282 $body = ''; 286 $body = '';
283 287
284 while (my $h = fastcgi_read_record(\$buf)) { 288 while (my $h = fastcgi_read_record(\$buf)) {
285 $version = $h->{version}; 289 $version = $h->{version};
286 $id = $h->{id}; 290 $id = $h->{id};
312 eval { 316 eval {
313 local $SIG{ALRM} = sub { die "timeout\n" }; 317 local $SIG{ALRM} = sub { die "timeout\n" };
314 local $SIG{PIPE} = sub { die "sigpipe\n" }; 318 local $SIG{PIPE} = sub { die "sigpipe\n" };
315 alarm(5); 319 alarm(5);
316 320
321 log_out($buf);
317 $s->write($buf); 322 $s->write($buf);
323
318 $client->sysread($buf, 1024); 324 $client->sysread($buf, 1024);
325 log2i($buf);
326
319 $body = ''; 327 $body = '';
320 328
321 while (my $h = fastcgi_read_record(\$buf)) { 329 while (my $h = fastcgi_read_record(\$buf)) {
322 330
323 # skip everything unless stdin 331 # skip everything unless stdin
353 local $SIG{ALRM} = sub { die "timeout\n" }; 361 local $SIG{ALRM} = sub { die "timeout\n" };
354 local $SIG{PIPE} = sub { die "sigpipe\n" }; 362 local $SIG{PIPE} = sub { die "sigpipe\n" };
355 alarm(5); 363 alarm(5);
356 364
357 $s->sysread($buf, 1024); 365 $s->sysread($buf, 1024);
366 log_in($buf);
367
358 $s->close(); 368 $s->close();
359 369
360 alarm(0); 370 alarm(0);
361 }; 371 };
362 alarm(0); 372 alarm(0);
368 return $buf; 378 return $buf;
369 }; 379 };
370 return $f; 380 return $f;
371 } 381 }
372 382
383 sub log2i { Test::Nginx::log_core('|| <<', @_); }
384 sub log2o { Test::Nginx::log_core('|| >>', @_); }
385 sub log2c { Test::Nginx::log_core('||', @_); }
386
373 ############################################################################### 387 ###############################################################################
374 388
375 sub fastcgi_daemon { 389 sub fastcgi_daemon {
376 my $socket = FCGI::OpenSocket('127.0.0.1:8081', 5); 390 my $socket = FCGI::OpenSocket('127.0.0.1:8081', 5);
377 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV, 391 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV,