comparison realip_remote_addr.t @ 1054:9b8e13e2ee67

Tests: one more $realip_remote_addr test case on internal redirect. List the address set by realip in set_real_ip_from to catch the bug causing $realip_remote_addr overwrite fixed in cecf415643d7 (1.11.5).
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 11 Oct 2016 13:08:00 +0300
parents 196d33c2bb45
children 766bcbb632ee
comparison
equal deleted inserted replaced
1053:fbf731526f49 1054:9b8e13e2ee67
35 35
36 http { 36 http {
37 %%TEST_GLOBALS_HTTP%% 37 %%TEST_GLOBALS_HTTP%%
38 38
39 set_real_ip_from 127.0.0.1/32; 39 set_real_ip_from 127.0.0.1/32;
40 set_real_ip_from 192.0.2.1/32;
40 real_ip_header X-Forwarded-For; 41 real_ip_header X-Forwarded-For;
41 42
42 server { 43 server {
43 listen 127.0.0.1:8080; 44 listen 127.0.0.1:8080;
44 server_name localhost; 45 server_name localhost;
65 66
66 like(http_get('/1'), qr/X-Real-IP: 127.0.0.1/m, 'request'); 67 like(http_get('/1'), qr/X-Real-IP: 127.0.0.1/m, 'request');
67 like(http_get('/'), qr/X-Real-IP: 127.0.0.1/m, 'request redirect'); 68 like(http_get('/'), qr/X-Real-IP: 127.0.0.1/m, 'request redirect');
68 69
69 like(http_xff('/1', '192.0.2.1'), qr/X-Real-IP: 127.0.0.1/m, 'realip'); 70 like(http_xff('/1', '192.0.2.1'), qr/X-Real-IP: 127.0.0.1/m, 'realip');
71
72 TODO: {
73 local $TODO = 'not yet' unless $t->has_version('1.11.5');
74
70 like(http_xff('/', '192.0.2.1'), qr/X-Real-IP: 127.0.0.1/m, 'realip redirect'); 75 like(http_xff('/', '192.0.2.1'), qr/X-Real-IP: 127.0.0.1/m, 'realip redirect');
76
77 }
71 78
72 ############################################################################### 79 ###############################################################################
73 80
74 sub http_xff { 81 sub http_xff {
75 my ($uri, $xff) = @_; 82 my ($uri, $xff) = @_;