in t/http11/chunked.t [29:74]
sub expect_chunked {
my $size = shift;
sok sub {
my $res = GET "/random_chunk?0,$size";
my $body = $res->content;
my $length = 0;
if ($body =~ s/__END__:(\d+)$//) {
$length = $1;
}
ok t_cmp($res->protocol,
"HTTP/1.1",
"response protocol"
);
my $enc = $res->header('Transfer-Encoding') ||
$res->header('Client-Transfer-Encoding') || #lwp 5.61+
'';
my $ct = $res->header('Content-Length') || 0;
ok t_cmp($enc,
"chunked",
"response Transfer-Encoding"
);
ok t_cmp($ct,
0,
"no Content-Length"
);
ok t_cmp(length($body),
$length,
"body length"
);
$requests++;
my $request_num =
Apache::TestRequest::user_agent_request_num($res);
return t_cmp($request_num,
$requests,
"number of requests"
);
}, 5;
}