View | Details | Raw Unified | Return to bug 28200
Collapse All | Expand All

(-)a/t/Koha/Middleware/RealIP.t (-8 / +1 lines)
Lines 100-118 subtest "Success multiple proxies" => sub { Link Here
100
};
100
};
101
101
102
subtest "Test alternative configuration styles" => sub {
102
subtest "Test alternative configuration styles" => sub {
103
    plan tests => 3;
103
    plan tests => 2;
104
    $remote_address = "2.2.2.2";
104
    $remote_address = "2.2.2.2";
105
    $x_forwarded_for_header = "1.1.1.1";
105
    $x_forwarded_for_header = "1.1.1.1";
106
    t::lib::Mocks::mock_config('koha_trusted_proxies', '2.2.2.0/24');
106
    t::lib::Mocks::mock_config('koha_trusted_proxies', '2.2.2.0/24');
107
    $address = Koha::Middleware::RealIP::get_real_ip( $remote_address, $x_forwarded_for_header );
107
    $address = Koha::Middleware::RealIP::get_real_ip( $remote_address, $x_forwarded_for_header );
108
    is($address,'1.1.1.1',"Trust proxy (2.2.2.2) using CIDR notation, so use the X-Forwarded-For header for the remote address");
108
    is($address,'1.1.1.1',"Trust proxy (2.2.2.2) using CIDR notation, so use the X-Forwarded-For header for the remote address");
109
109
110
    $remote_address = "2.2.2.2";
111
    $x_forwarded_for_header = "1.1.1.1";
112
    t::lib::Mocks::mock_config('koha_trusted_proxies', '2.2.2');
113
    $address = Koha::Middleware::RealIP::get_real_ip( $remote_address, $x_forwarded_for_header );
114
    is($address,'1.1.1.1',"Trust proxy (2.2.2.2) using abbreviated notation, so use the X-Forwarded-For header for the remote address");
115
116
    $remote_address = "2.2.2.2";
110
    $remote_address = "2.2.2.2";
117
    $x_forwarded_for_header = "1.1.1.1";
111
    $x_forwarded_for_header = "1.1.1.1";
118
    t::lib::Mocks::mock_config('koha_trusted_proxies', '2.2.2.0:255.255.255.0');
112
    t::lib::Mocks::mock_config('koha_trusted_proxies', '2.2.2.0:255.255.255.0');
119
- 

Return to bug 28200