comparison src/http/modules/ngx_http_realip_module.c @ 986:68c85f283043

ngx_http_realip_module must return NGX_DECLINED
author Igor Sysoev <igor@sysoev.ru>
date Sun, 07 Jan 2007 18:45:55 +0000
parents 7e24168b0853
children 3f354952e91d
comparison
equal deleted inserted replaced
985:36f70b8776e7 986:68c85f283043
101 struct sockaddr_in *sin; 101 struct sockaddr_in *sin;
102 ngx_http_realip_from_t *from; 102 ngx_http_realip_from_t *from;
103 ngx_http_realip_loc_conf_t *rlcf; 103 ngx_http_realip_loc_conf_t *rlcf;
104 104
105 if (r->realip_set) { 105 if (r->realip_set) {
106 return NGX_OK; 106 return NGX_DECLINED;
107 } 107 }
108 108
109 rlcf = ngx_http_get_module_loc_conf(r, ngx_http_realip_module); 109 rlcf = ngx_http_get_module_loc_conf(r, ngx_http_realip_module);
110 110
111 if (rlcf->from == NULL) { 111 if (rlcf->from == NULL) {
112 return NGX_OK; 112 return NGX_DECLINED;
113 } 113 }
114 114
115 if (rlcf->xfwd == 0) { 115 if (rlcf->xfwd == 0) {
116 if (r->headers_in.x_real_ip == NULL) { 116 if (r->headers_in.x_real_ip == NULL) {
117 return NGX_OK; 117 return NGX_DECLINED;
118 } 118 }
119 119
120 len = r->headers_in.x_real_ip->value.len; 120 len = r->headers_in.x_real_ip->value.len;
121 ip = r->headers_in.x_real_ip->value.data; 121 ip = r->headers_in.x_real_ip->value.data;
122 122
123 } else { 123 } else {
124 if (r->headers_in.x_forwarded_for == NULL) { 124 if (r->headers_in.x_forwarded_for == NULL) {
125 return NGX_OK; 125 return NGX_DECLINED;
126 } 126 }
127 127
128 len = r->headers_in.x_forwarded_for->value.len; 128 len = r->headers_in.x_forwarded_for->value.len;
129 ip = r->headers_in.x_forwarded_for->value.data; 129 ip = r->headers_in.x_forwarded_for->value.data;
130 130
156 156
157 sin->sin_addr.s_addr = inet_addr((char *) ip); 157 sin->sin_addr.s_addr = inet_addr((char *) ip);
158 158
159 r->realip_set = 1; 159 r->realip_set = 1;
160 160
161 return NGX_OK; 161 return NGX_DECLINED;
162 } 162 }
163 } 163 }
164 164
165 return NGX_OK; 165 return NGX_DECLINED;
166 } 166 }
167 167
168 168
169 static char * 169 static char *
170 ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 170 ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)