Mercurial > hg > nginx
comparison src/http/modules/ngx_http_realip_module.c @ 4562:b1950b0a9550
Replaced ngx_http_realip_from_t with ngx_in_cidr_t.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Wed, 28 Mar 2012 09:29:09 +0000 |
parents | d620f497c50f |
children | df93068953c0 |
comparison
equal
deleted
inserted
replaced
4561:ae63013cbffa | 4562:b1950b0a9550 |
---|---|
14 #define NGX_HTTP_REALIP_XFWD 1 | 14 #define NGX_HTTP_REALIP_XFWD 1 |
15 #define NGX_HTTP_REALIP_HEADER 2 | 15 #define NGX_HTTP_REALIP_HEADER 2 |
16 | 16 |
17 | 17 |
18 typedef struct { | 18 typedef struct { |
19 in_addr_t mask; | 19 ngx_array_t *from; /* array of ngx_in_cidr_t */ |
20 in_addr_t addr; | |
21 } ngx_http_realip_from_t; | |
22 | |
23 | |
24 typedef struct { | |
25 ngx_array_t *from; /* array of ngx_http_realip_from_t */ | |
26 ngx_uint_t type; | 20 ngx_uint_t type; |
27 ngx_uint_t hash; | 21 ngx_uint_t hash; |
28 ngx_str_t header; | 22 ngx_str_t header; |
29 #if (NGX_HAVE_UNIX_DOMAIN) | 23 #if (NGX_HAVE_UNIX_DOMAIN) |
30 ngx_uint_t unixsock; /* unsigned unixsock:2; */ | 24 ngx_uint_t unixsock; /* unsigned unixsock:2; */ |
112 size_t len; | 106 size_t len; |
113 ngx_uint_t i, hash; | 107 ngx_uint_t i, hash; |
114 ngx_list_part_t *part; | 108 ngx_list_part_t *part; |
115 ngx_table_elt_t *header; | 109 ngx_table_elt_t *header; |
116 struct sockaddr_in *sin; | 110 struct sockaddr_in *sin; |
111 ngx_in_cidr_t *from; | |
117 ngx_connection_t *c; | 112 ngx_connection_t *c; |
118 ngx_http_realip_ctx_t *ctx; | 113 ngx_http_realip_ctx_t *ctx; |
119 ngx_http_realip_from_t *from; | |
120 ngx_http_realip_loc_conf_t *rlcf; | 114 ngx_http_realip_loc_conf_t *rlcf; |
121 | 115 |
122 ctx = ngx_http_get_module_ctx(r, ngx_http_realip_module); | 116 ctx = ngx_http_get_module_ctx(r, ngx_http_realip_module); |
123 | 117 |
124 if (ctx) { | 118 if (ctx) { |
315 ngx_http_realip_loc_conf_t *rlcf = conf; | 309 ngx_http_realip_loc_conf_t *rlcf = conf; |
316 | 310 |
317 ngx_int_t rc; | 311 ngx_int_t rc; |
318 ngx_str_t *value; | 312 ngx_str_t *value; |
319 ngx_cidr_t cidr; | 313 ngx_cidr_t cidr; |
320 ngx_http_realip_from_t *from; | 314 ngx_in_cidr_t *from; |
321 | 315 |
322 value = cf->args->elts; | 316 value = cf->args->elts; |
323 | 317 |
324 #if (NGX_HAVE_UNIX_DOMAIN) | 318 #if (NGX_HAVE_UNIX_DOMAIN) |
325 | 319 |
330 | 324 |
331 #endif | 325 #endif |
332 | 326 |
333 if (rlcf->from == NULL) { | 327 if (rlcf->from == NULL) { |
334 rlcf->from = ngx_array_create(cf->pool, 2, | 328 rlcf->from = ngx_array_create(cf->pool, 2, |
335 sizeof(ngx_http_realip_from_t)); | 329 sizeof(ngx_in_cidr_t)); |
336 if (rlcf->from == NULL) { | 330 if (rlcf->from == NULL) { |
337 return NGX_CONF_ERROR; | 331 return NGX_CONF_ERROR; |
338 } | 332 } |
339 } | 333 } |
340 | 334 |