Mercurial > hg > nginx-tests
changeset 23:e6b7c3b5389c
Tests: test for multiple buffers in proxy-noclose.t.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 29 Sep 2008 02:10:07 +0400 |
parents | 5e65db715827 |
children | 89b00444c168 |
files | proxy-noclose.t |
diffstat | 1 files changed, 20 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/proxy-noclose.t Mon Sep 29 01:47:02 2008 +0400 +++ b/proxy-noclose.t Mon Sep 29 02:10:07 2008 +0400 @@ -11,7 +11,9 @@ use warnings; use strict; -use Test::More tests => 1; +use Test::More tests => 2; + +use IO::Select; BEGIN { use FindBin; chdir($FindBin::Bin); } @@ -59,8 +61,8 @@ TODO: { local $TODO = 'not fixed yet, submit patches'; -my $t1 = http_request('/'); -like($t1, qr/TEST-OK-IF-YOU-SEE-THIS/, 'request to bad backend'); +like(http_request('/'), qr/TEST-OK-IF-YOU-SEE-THIS/, 'request to bad backend'); +like(http_request('/multi'), qr/AND-THIS/, 'bad backend - multiple packets'); } @@ -88,18 +90,30 @@ while (my $client = $server->accept()) { $client->autoflush(1); + my $multi = 0; + while (<$client>) { + $multi = 1 if /multi/; last if (/^\x0d?\x0a?$/); } - print $client <<'EOF'; + my $length = $multi ? 32 : 24; + + print $client <<"EOF"; HTTP/1.1 200 OK -Content-Length: 24 +Content-Length: $length Connection: close TEST-OK-IF-YOU-SEE-THIS EOF - sleep 2; + + if ($multi) { + select undef, undef, undef, 0.1; + print $client 'AND-THIS'; + } + + my $select = IO::Select->new($client); + $select->can_read(2); close $client; } }