changeset 1167:1e79a9613813

Tests: handled SIGPIPE in fastcgi tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 20 Apr 2017 16:05:10 +0300
parents 2b8523bd4988
children 8821e405b91e
files fastcgi_request_buffering.t fastcgi_request_buffering_chunked.t
diffstat 2 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/fastcgi_request_buffering.t
+++ b/fastcgi_request_buffering.t
@@ -303,7 +303,12 @@ EOF
 	$f->{http_end} = sub {
 		my $buf = '';
 
-		fastcgi_respond($client, $version, $id, <<EOF);
+		eval {
+			local $SIG{ALRM} = sub { die "timeout\n" };
+			local $SIG{PIPE} = sub { die "sigpipe\n" };
+			alarm(5);
+
+			fastcgi_respond($client, $version, $id, <<EOF);
 Status: 200 OK
 Connection: close
 X-Port: $port
@@ -311,12 +316,7 @@ X-Port: $port
 OK
 EOF
 
-		$client->close;
-
-		eval {
-			local $SIG{ALRM} = sub { die "timeout\n" };
-			local $SIG{PIPE} = sub { die "sigpipe\n" };
-			alarm(5);
+			$client->close;
 
 			$s->sysread($buf, 1024);
 			log_in($buf);
--- a/fastcgi_request_buffering_chunked.t
+++ b/fastcgi_request_buffering_chunked.t
@@ -346,7 +346,12 @@ EOF
 	$f->{http_end} = sub {
 		my $buf = '';
 
-		fastcgi_respond($client, $version, $id, <<EOF);
+		eval {
+			local $SIG{ALRM} = sub { die "timeout\n" };
+			local $SIG{PIPE} = sub { die "sigpipe\n" };
+			alarm(5);
+
+			fastcgi_respond($client, $version, $id, <<EOF);
 Status: 200 OK
 Connection: close
 X-Port: $port
@@ -354,12 +359,7 @@ X-Port: $port
 OK
 EOF
 
-		$client->close;
-
-		eval {
-			local $SIG{ALRM} = sub { die "timeout\n" };
-			local $SIG{PIPE} = sub { die "sigpipe\n" };
-			alarm(5);
+			$client->close;
 
 			$s->sysread($buf, 1024);
 			log_in($buf);