~ubuntu-branches/ubuntu/edgy/libapache2-mod-perl2/edgy

« back to all changes in this revision

Viewing changes to t/response/TestAPI/conn_rec.pm

  • Committer: Bazaar Package Importer
  • Author(s): Andres Salomon
  • Date: 2005-08-12 01:40:38 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050812014038-gjigefs55pqx4qc8
Tags: 2.0.1-3
Grr.  Really include perl.conf file; it got lost due to diff not
wanting to add an empty file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
package TestAPI::conn_rec;
2
2
 
 
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)
 
5
 
3
6
use strict;
4
7
use warnings FATAL => 'all';
5
8
 
6
9
use Apache::TestUtil;
7
10
use Apache::Test;
8
11
 
9
 
use Apache::RequestRec ();
10
 
use Apache::RequestUtil ();
11
 
use Apache::Connection ();
12
 
 
13
 
use Apache::Const -compile => qw(OK REMOTE_HOST REMOTE_NAME
14
 
    REMOTE_NOLOOKUP REMOTE_DOUBLE_REV CONN_CLOSE);
15
 
 
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 ();
 
15
 
 
16
use Apache2::Const -compile => qw(OK CONN_CLOSE);
18
17
 
19
18
sub handler {
20
19
    my $r = shift;
21
20
 
22
21
    my $c = $r->connection;
23
22
 
24
 
    plan $r, tests => 23;
 
23
    plan $r, tests => 16;
25
24
 
26
25
    ok $c;
27
26
 
28
27
    ok $c->pool->isa('APR::Pool');
29
28
 
30
 
    ok $c->base_server->isa('Apache::Server');
 
29
    ok $c->base_server->isa('Apache2::ServerRec');
31
30
 
32
31
    ok $c->client_socket->isa('APR::Socket');
33
32
 
35
34
 
36
35
    ok $c->remote_addr->isa('APR::SockAddr');
37
36
 
38
 
    ok $c->remote_ip;
 
37
    # remote_ip
 
38
    {
 
39
        my $remote_ip_org = $c->remote_ip;
 
40
        my $remote_ip_new = "10.10.10.255";
 
41
        ok $remote_ip_org;
 
42
 
 
43
        $c->remote_ip($remote_ip_new);
 
44
        ok t_cmp $c->remote_ip, $remote_ip_new;
 
45
 
 
46
        # restore
 
47
        $c->remote_ip($remote_ip_org);
 
48
        ok t_cmp $c->remote_ip, $remote_ip_org;
 
49
    }
39
50
 
40
51
    ok $c->remote_host || 1;
41
52
 
42
 
    ok $c->remote_logname || 1;
43
 
 
44
 
    ok $c->aborted || 1;
45
 
 
46
 
    ok t_cmp(Apache::CONN_CLOSE,
47
 
             $c->keepalive,
 
53
    ok !$c->aborted;
 
54
 
 
55
    ok t_cmp($c->keepalive,
 
56
             Apache2::Const::CONN_CLOSE,
48
57
             "the client has issued a non-keepalive request");
49
58
 
50
59
    ok $c->local_ip;
51
60
 
52
61
    ok $c->local_host || 1;
53
62
 
 
63
    t_debug "id ", ($c->id == 0 ? "zero" : $c->id);
54
64
    ok $c->id || 1;
55
65
 
56
 
    #conn_config
57
 
 
58
66
    ok $c->notes;
59
67
 
60
 
    ok $r->notes;
61
 
 
62
 
    #input_filters
63
 
    #output_filters
64
 
    #remain
65
 
 
66
 
    # Connection utils (XXX: move to conn_utils.pm?)
67
 
 
68
 
    # $c->get_remote_host
69
 
    ok $c->get_remote_host() || 1;
70
 
 
71
 
    for (Apache::REMOTE_HOST, Apache::REMOTE_NAME, 
72
 
        Apache::REMOTE_NOLOOKUP, Apache::REMOTE_DOUBLE_REV) {
73
 
        ok $c->get_remote_host($_) || 1;
74
 
    }
75
 
 
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;
79
 
 
80
 
    Apache::OK;
 
68
    # XXX: missing tests
 
69
    # conn_config
 
70
 
 
71
    Apache2::Const::OK;
81
72
}
82
73
 
83
74
1;