sub expect_not_chunked()

in t/http11/chunked.t [76:120]


sub expect_not_chunked {
    my $size = shift;
    sok sub {
        my $res = GET "/random_chunk?0,$size";
        my $body = $res->content;
        my $content_length = length $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') || '';
        my $ct  = $res->header('Content-Length') || '';

        ok !t_cmp($enc,
                  "chunked",
                  "no Transfer-Encoding (test result inverted)"
                 );

        ok t_cmp($ct,
                 (($ct eq '') ? $ct : $content_length),
                 "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;
}