1
package TestAPI::request_util;
4
use warnings FATAL => 'all';
9
use Apache2::RequestUtil ();
14
use Apache2::Const -compile => 'OK';
18
400 => '400 Bad Request',
19
500 => '500 Internal Server Error',
25
plan $r, tests => (scalar keys %status_lines) + 11;
29
my $document_root = $r->document_root;
33
if (!Apache2::MPM->is_threaded) {
34
my $path_orig = my $path = '/tmp/foo';
35
ok t_cmp($document_root, $r->document_root($path));
36
# make sure that the new docroot string is copied internally,
37
# and later manipulations of the passed scalar don't affect it
39
ok t_cmp($path_orig, $r->document_root($document_root));
42
eval { $r->document_root('/tmp/foo') };
43
ok t_cmp($@, qr/Can't run.*in the threaded env/,
44
"document_root is read-only under threads");
48
ok $r->get_server_name;
50
ok $r->get_server_port;
52
ok $r->get_limit_req_body || 1;
54
ok $r->is_initial_req;
56
my $sig = $r->psignature("Here is the sig: ");
61
qr!(?s)GET /TestAPI__request_util.*Host:.*200 OK.*Content-Type:!;
63
ok t_cmp($r->as_string,
65
"test for the request_line, host, status, and few " .
66
"headers that should always be there");
68
while (my($code, $line) = each %status_lines) {
69
ok t_cmp(Apache2::RequestUtil::get_status_line($code),
71
"Apache2::RequestUtil::get_status_line($code)");
74
if (Apache2::MPM->is_threaded) {
75
eval { $r->child_terminate() };
76
ok t_cmp($@, qr/Can't run.*in a threaded mpm/, "child_terminate");
79
t_server_log_error_is_expected();
80
ok $r->child_terminate() || 1;
81
$r->pool->cleanup_register(
84
$r->log_error("Process $$ terminates itself\n");