Mercurial > hg > nginx-tests
changeset 270:f857180657c9
Tests: whitespace, no functional changes.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 20 Mar 2013 19:42:16 +0400 |
parents | 970bb423e59f |
children | 1a6eef7ac914 |
files | lib/Test/Nginx.pm |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/Test/Nginx.pm +++ b/lib/Test/Nginx.pm @@ -402,21 +402,27 @@ EOF sub http($;%) { my ($request, %extra) = @_; my $reply; + eval { local $SIG{ALRM} = sub { die "timeout\n" }; local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm($extra{timeout} || 2); + my $s = $extra{socket} || IO::Socket::INET->new( Proto => 'tcp', PeerAddr => '127.0.0.1:8080' ) or die "Can't connect to nginx: $!\n"; + log_out($request); $s->print($request); - local $/; + select undef, undef, undef, $extra{sleep} if $extra{sleep}; return '' if $extra{aborted}; + + local $/; $reply = $s->getline(); + alarm(0); }; alarm(0); @@ -424,6 +430,7 @@ sub http($;%) { log_in("died: $@"); return undef; } + log_in($reply); return $reply; }