jerenkrantz 2002/06/03 00:12:16
Added: perl-framework/t/apache chunkinput.t
Log:
Add chunking input test with mod_echo_chunk_post:
- 0-length chunk followed by a trailer (which is our pid).
(Expect 200 response with our input trailer as response entity.)
- AAAAAAAAAAAAAAAAAAAAAAAA-length chunk followed by a trailer.
(Expect 413 error response.)
Revision Changes Path
1.1 httpd-test/perl-framework/t/apache/chunkinput.t
Index: chunkinput.t
===================================================================
use strict;
use warnings FATAL => 'all';
use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest ();
my @test_strings = ("0","AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",);
my @resp_strings = ("HTTP/1.1 200 OK","HTTP/1.1 413 Request Entity Too
Large",);
my $tests = 2 * @test_strings + 1;
my $vars = Apache::Test::vars();
my $module = 'default';
my $cycle = 0;
plan tests => $tests;
print "testing $module\n";
for my $data (@test_strings) {
my $sock = Apache::TestRequest::vhost_socket($module);
ok $sock;
Apache::TestRequest::socket_trace($sock);
$sock->print("POST /echo_post_chunk HTTP/1.0\n");
$sock->print("Transfer-Encoding: chunked\n");
$sock->print("\n");
$sock->print("$data\n");
$sock->print("X-Chunk-Trailer: $$\n");
$sock->print("\n");
#Read the status line
chomp(my $response = Apache::TestRequest::getline($sock));
$response =~ s/\s$//;
ok t_cmp($resp_strings[$cycle++], $response, "response codes");
do {
chomp($response = Apache::TestRequest::getline($sock));
$response =~ s/\s$//;
}
while ($response ne "");
if ($cycle == 1) {
chomp($response = Apache::TestRequest::getline($sock));
ok t_cmp("$$", $response, "trailer (pid)");
}
}