1
1
package TestAPI::conn_rec;
3
# this test module is only for testing fields in the conn_rec listed
4
# in apache_structures.map (but some fields are tested in other tests)
4
7
use warnings FATAL => 'all';
6
9
use Apache::TestUtil;
9
use Apache::RequestRec ();
10
use Apache::RequestUtil ();
11
use Apache::Connection ();
13
use Apache::Const -compile => qw(OK REMOTE_HOST REMOTE_NAME
14
REMOTE_NOLOOKUP REMOTE_DOUBLE_REV CONN_CLOSE);
16
#this test module is only for testing fields in the conn_rec
17
#listed in apache_structures.map
12
use Apache2::RequestRec ();
13
use Apache2::RequestUtil ();
14
use Apache2::Connection ();
16
use Apache2::Const -compile => qw(OK CONN_CLOSE);
22
21
my $c = $r->connection;
28
27
ok $c->pool->isa('APR::Pool');
30
ok $c->base_server->isa('Apache::Server');
29
ok $c->base_server->isa('Apache2::ServerRec');
32
31
ok $c->client_socket->isa('APR::Socket');
36
35
ok $c->remote_addr->isa('APR::SockAddr');
39
my $remote_ip_org = $c->remote_ip;
40
my $remote_ip_new = "10.10.10.255";
43
$c->remote_ip($remote_ip_new);
44
ok t_cmp $c->remote_ip, $remote_ip_new;
47
$c->remote_ip($remote_ip_org);
48
ok t_cmp $c->remote_ip, $remote_ip_org;
40
51
ok $c->remote_host || 1;
42
ok $c->remote_logname || 1;
46
ok t_cmp(Apache::CONN_CLOSE,
55
ok t_cmp($c->keepalive,
56
Apache2::Const::CONN_CLOSE,
48
57
"the client has issued a non-keepalive request");
52
61
ok $c->local_host || 1;
63
t_debug "id ", ($c->id == 0 ? "zero" : $c->id);
66
# Connection utils (XXX: move to conn_utils.pm?)
69
ok $c->get_remote_host() || 1;
71
for (Apache::REMOTE_HOST, Apache::REMOTE_NAME,
72
Apache::REMOTE_NOLOOKUP, Apache::REMOTE_DOUBLE_REV) {
73
ok $c->get_remote_host($_) || 1;
76
ok $c->get_remote_host(Apache::REMOTE_HOST,
77
$r->per_dir_config) || 1;
78
ok $c->get_remote_host(Apache::REMOTE_HOST, $r->per_dir_config) || 1;