blob: f84b97b603c1b82e0ccf3400e409b800a3446776 [file] [log] [blame]
use strict;
use warnings FATAL => 'all';
use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest ();
my @test_strings = ("",
"0",
"0000000000000000000000000000000000",
"1000000000000000000000000000000000",
"-1",
);
my @req_strings = ("/echo_post",
"/i_do_not_exist_in_your_wildest_imagination");
# This is expanded out.
my @resp_strings = ("HTTP/1.1 200 OK",
"HTTP/1.1 404 Not Found",
"HTTP/1.1 200 OK",
"HTTP/1.1 404 Not Found",
"HTTP/1.1 200 OK",
"HTTP/1.1 404 Not Found",
"HTTP/1.1 413 Request Entity Too Large",
"HTTP/1.1 413 Request Entity Too Large",
"HTTP/1.1 413 Request Entity Too Large",
"HTTP/1.1 413 Request Entity Too Large",
);
my $tests = 4 * @test_strings;
my $vars = Apache::Test::vars();
my $module = 'default';
my $cycle = 0;
plan tests => $tests;
print "testing $module\n";
for my $data (@test_strings) {
for my $request_uri (@req_strings) {
my $sock = Apache::TestRequest::vhost_socket($module);
ok $sock;
Apache::TestRequest::socket_trace($sock);
$sock->print("POST $request_uri HTTP/1.0\n");
$sock->print("Content-Length: $data\n");
$sock->print("\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 "");
}
}