Mercurial > hg > nginx
comparison src/http/modules/ngx_http_geo_module.c @ 5084:f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Wed, 27 Feb 2013 13:29:50 +0000 |
parents | 3f776d65c5b9 |
children | 5482671df278 |
comparison
equal
deleted
inserted
replaced
5083:a805dc9c85cd | 5084:f7fe817c92a2 |
---|---|
312 | 312 |
313 static ngx_int_t | 313 static ngx_int_t |
314 ngx_http_geo_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx, | 314 ngx_http_geo_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx, |
315 ngx_addr_t *addr) | 315 ngx_addr_t *addr) |
316 { | 316 { |
317 ngx_table_elt_t *xfwd; | 317 ngx_array_t *xfwd; |
318 | 318 |
319 if (ngx_http_geo_real_addr(r, ctx, addr) != NGX_OK) { | 319 if (ngx_http_geo_real_addr(r, ctx, addr) != NGX_OK) { |
320 return NGX_ERROR; | 320 return NGX_ERROR; |
321 } | 321 } |
322 | 322 |
323 xfwd = r->headers_in.x_forwarded_for; | 323 xfwd = &r->headers_in.x_forwarded_for; |
324 | 324 |
325 if (xfwd != NULL && ctx->proxies != NULL) { | 325 if (xfwd->nelts > 0 && ctx->proxies != NULL) { |
326 (void) ngx_http_get_forwarded_addr(r, addr, xfwd->value.data, | 326 (void) ngx_http_get_forwarded_addr(r, addr, xfwd, NULL, |
327 xfwd->value.len, ctx->proxies, | 327 ctx->proxies, ctx->proxy_recursive); |
328 ctx->proxy_recursive); | |
329 } | 328 } |
330 | 329 |
331 return NGX_OK; | 330 return NGX_OK; |
332 } | 331 } |
333 | 332 |