Mercurial > hg > nginx-tests
comparison http_keepalive.t @ 1166:2b8523bd4988
Tests: handled broken connections in http_keepalive.t.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 20 Apr 2017 16:03:50 +0300 |
parents | 8533222fcfc1 |
children | 6c4f9941ae9f |
comparison
equal
deleted
inserted
replaced
1165:ba26845f53ff | 1166:2b8523bd4988 |
---|---|
113 $opts{ua} = $opts{ua} || ''; | 113 $opts{ua} = $opts{ua} || ''; |
114 $opts{req} = $opts{req} || 1; | 114 $opts{req} = $opts{req} || 1; |
115 $opts{sleep} = $opts{sleep} || 0; | 115 $opts{sleep} = $opts{sleep} || 0; |
116 $opts{method} = $opts{method} || 'GET'; | 116 $opts{method} = $opts{method} || 'GET'; |
117 | 117 |
118 local $SIG{PIPE} = 'IGNORE'; | |
119 | |
118 my $s = http('', start => 1); | 120 my $s = http('', start => 1); |
119 | 121 |
120 for my $i (1 .. $opts{req}) { | 122 for my $i (1 .. $opts{req}) { |
121 | 123 |
122 my $sleep = ($i == 1 ? $opts{sleep} : 0); | 124 my $sleep = ($i == 1 ? $opts{sleep} : 0); |
127 User-Agent: $opts{ua} | 129 User-Agent: $opts{ua} |
128 | 130 |
129 EOF | 131 EOF |
130 | 132 |
131 while (IO::Select->new($s)->can_read(3)) { | 133 while (IO::Select->new($s)->can_read(3)) { |
132 sysread($s, my $buffer, 4096); | 134 sysread($s, my $buffer, 4096) or last; |
133 $data .= $buffer; | 135 $data .= $buffer; |
134 last if $data =~ /^\x0d\x0a/ms; | 136 last if $data =~ /^\x0d\x0a/ms; |
135 } | 137 } |
136 | 138 |
137 } | 139 } |