comparison src/http/modules/ngx_http_realip_module.c @ 272:29a6403156b0 NGINX_0_5_6

nginx 0.5.6 *) Change: now the ngx_http_index_module ignores all methods except the GET, HEAD, and POST methods. *) Feature: the ngx_http_limit_zone_module. *) Feature: the $binary_remote_addr variable. *) Feature: the "ssl_session_cache" directives of the ngx_http_ssl_module and ngx_imap_ssl_module. *) Feature: the DELETE method supports recursive removal. *) Bugfix: the byte-ranges were transferred incorrectly if the $r->sendfile() was used.
author Igor Sysoev <http://sysoev.ru>
date Tue, 09 Jan 2007 00:00:00 +0300
parents 38e7b94d63ac
children 5bef04fc3fd5
comparison
equal deleted inserted replaced
271:fcbee7dacf2b 272:29a6403156b0
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)