# HG changeset patch # User Sergey Kandaurov # Date 1454073162 -10800 # Node ID 68a6678abae263a4b767f78afc6a444791b84af1 # Parent a9c4cebcfe6934f4599997a8d2da2342385b9899 Tests: improved logging for unbuffered request body tests. diff --git a/fastcgi_request_buffering.t b/fastcgi_request_buffering.t --- a/fastcgi_request_buffering.t +++ b/fastcgi_request_buffering.t @@ -241,6 +241,8 @@ EOF $client = $server->accept(); + log2c("(new connection $client)"); + alarm(0); }; alarm(0); @@ -250,6 +252,8 @@ EOF } $client->sysread(my $buf, 1024); + log2i($buf); + $body = ''; while (my $h = fastcgi_read_record(\$buf)) { @@ -271,8 +275,12 @@ EOF local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm(5); + log_out($buf); $s->write($buf); + $client->sysread($buf, 1024); + log2i($buf); + $body = ''; while (my $h = fastcgi_read_record(\$buf)) { @@ -312,6 +320,7 @@ EOF alarm(5); $s->sysread($buf, 1024); + log_in($buf); alarm(0); }; @@ -326,6 +335,10 @@ EOF return $f; } +sub log2i { Test::Nginx::log_core('|| <<', @_); } +sub log2o { Test::Nginx::log_core('|| >>', @_); } +sub log2c { Test::Nginx::log_core('||', @_); } + ############################################################################### sub fastcgi_daemon { diff --git a/fastcgi_request_buffering_chunked.t b/fastcgi_request_buffering_chunked.t --- a/fastcgi_request_buffering_chunked.t +++ b/fastcgi_request_buffering_chunked.t @@ -270,6 +270,8 @@ EOF $client = $server->accept(); + log2c("(new connection $client)"); + alarm(0); }; alarm(0); @@ -279,6 +281,8 @@ EOF } $client->sysread(my $buf, 1024); + log2i($buf); + $body = ''; while (my $h = fastcgi_read_record(\$buf)) { @@ -314,8 +318,12 @@ EOF local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm(5); + log_out($buf); $s->write($buf); + $client->sysread($buf, 1024); + log2i($buf); + $body = ''; while (my $h = fastcgi_read_record(\$buf)) { @@ -355,6 +363,8 @@ EOF alarm(5); $s->sysread($buf, 1024); + log_in($buf); + $s->close(); alarm(0); @@ -370,6 +380,10 @@ EOF return $f; } +sub log2i { Test::Nginx::log_core('|| <<', @_); } +sub log2o { Test::Nginx::log_core('|| >>', @_); } +sub log2c { Test::Nginx::log_core('||', @_); } + ############################################################################### sub fastcgi_daemon { diff --git a/proxy_request_buffering.t b/proxy_request_buffering.t --- a/proxy_request_buffering.t +++ b/proxy_request_buffering.t @@ -207,6 +207,8 @@ EOF $client = $server->accept(); + log2c("(new connection $client)"); + alarm(0); }; alarm(0); @@ -216,6 +218,8 @@ EOF } $client->sysread(my $buf, 1024); + log2i($buf); + $buf =~ s/.*?\x0d\x0a?\x0d\x0a?(.*)/$1/ms; my $f = { preread => $buf }; @@ -227,8 +231,11 @@ EOF local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm(5); + log_out($buf); $s->write($buf); + $client->sysread($buf, 1024); + log2i($buf); alarm(0); }; @@ -259,6 +266,7 @@ EOF alarm(5); $s->sysread($buf, 1024); + log_in($buf); alarm(0); }; @@ -273,4 +281,8 @@ EOF return $f; } +sub log2i { Test::Nginx::log_core('|| <<', @_); } +sub log2o { Test::Nginx::log_core('|| >>', @_); } +sub log2c { Test::Nginx::log_core('||', @_); } + ############################################################################### diff --git a/proxy_request_buffering_chunked.t b/proxy_request_buffering_chunked.t --- a/proxy_request_buffering_chunked.t +++ b/proxy_request_buffering_chunked.t @@ -242,6 +242,8 @@ EOF $client = $server->accept(); + log2c("(new connection $client)"); + alarm(0); }; alarm(0); @@ -251,6 +253,8 @@ EOF } $client->sysread(my $buf, 1024); + log2i($buf); + $buf =~ s/.*?\x0d\x0a?\x0d\x0a?(.*)/$1/ms; my $f = { preread => $buf }; @@ -276,8 +280,11 @@ EOF local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm(5); + log_out($buf); $s->write($buf); + $client->sysread($buf, 1024); + log2i($buf); alarm(0); }; @@ -308,6 +315,8 @@ EOF alarm(5); $s->sysread($buf, 1024); + log_in($buf); + $s->close(); alarm(0); @@ -323,4 +332,8 @@ EOF return $f; } +sub log2i { Test::Nginx::log_core('|| <<', @_); } +sub log2o { Test::Nginx::log_core('|| >>', @_); } +sub log2c { Test::Nginx::log_core('||', @_); } + ############################################################################### diff --git a/proxy_request_buffering_ssl.t b/proxy_request_buffering_ssl.t --- a/proxy_request_buffering_ssl.t +++ b/proxy_request_buffering_ssl.t @@ -228,6 +228,8 @@ EOF $client = $server->accept(); + log2c("(new connection $client)"); + alarm(0); }; alarm(0); @@ -237,6 +239,8 @@ EOF } $client->sysread(my $buf, 1024); + log2i($buf); + $buf =~ s/.*?\x0d\x0a?\x0d\x0a?(.*)/$1/ms; my $f = { preread => $buf }; @@ -248,8 +252,11 @@ EOF local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm(5); + log_out($buf); $s->write($buf); + $client->sysread($buf, 1024); + log2i($buf); alarm(0); }; @@ -280,6 +287,7 @@ EOF alarm(5); $s->sysread($buf, 1024); + log_in($buf); alarm(0); }; @@ -294,4 +302,8 @@ EOF return $f; } +sub log2i { Test::Nginx::log_core('|| <<', @_); } +sub log2o { Test::Nginx::log_core('|| >>', @_); } +sub log2c { Test::Nginx::log_core('||', @_); } + ###############################################################################