changeset 1508:1a409a166420

Tests: fixed http_keepalive.t with short reads and double logging.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 16 Sep 2019 19:00:29 +0300
parents 8958b5b53c25
children 1603f2bad385
files http_keepalive.t
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/http_keepalive.t
+++ b/http_keepalive.t
@@ -108,7 +108,7 @@ like(http_keepalive('/zero'), qr/Connect
 
 sub http_keepalive {
 	my ($url, %opts) = @_;
-	my $data = '';
+	my $total = '';
 
 	$opts{ua} = $opts{ua} || '';
 	$opts{req} = $opts{req} || 1;
@@ -130,6 +130,8 @@ User-Agent: $opts{ua}
 
 EOF
 
+		my $data = '';
+
 		while (IO::Select->new($s)->can_read(3)) {
 			sysread($s, my $buffer, 4096) or last;
 			$data .= $buffer;
@@ -137,9 +139,11 @@ EOF
 		}
 
 		log_in($data);
+
+		$total .= $data;
 	}
 
-	return $data;
+	return $total;
 }
 
 sub count_keepalive {