diff options
author | Ruslan Ermilov <ru@nginx.com> | 2013-02-27 13:29:50 +0000 |
---|---|---|
committer | Ruslan Ermilov <ru@nginx.com> | 2013-02-27 13:29:50 +0000 |
commit | 67a68720b7f08542c891d7b9ef08f07e3543b0e4 (patch) | |
tree | b61423ee7b49a7280f87d66606c96785681d71ad /src/http/modules/ngx_http_geo_module.c | |
parent | 40ea120b34342a3aa80f27378c7f05360b2da7a0 (diff) | |
download | nginx-67a68720b7f08542c891d7b9ef08f07e3543b0e4.tar.gz nginx-67a68720b7f08542c891d7b9ef08f07e3543b0e4.zip |
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Diffstat (limited to 'src/http/modules/ngx_http_geo_module.c')
-rw-r--r-- | src/http/modules/ngx_http_geo_module.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c index a927ab798..725baa211 100644 --- a/src/http/modules/ngx_http_geo_module.c +++ b/src/http/modules/ngx_http_geo_module.c @@ -314,18 +314,17 @@ static ngx_int_t ngx_http_geo_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx, ngx_addr_t *addr) { - ngx_table_elt_t *xfwd; + ngx_array_t *xfwd; if (ngx_http_geo_real_addr(r, ctx, addr) != NGX_OK) { return NGX_ERROR; } - xfwd = r->headers_in.x_forwarded_for; + xfwd = &r->headers_in.x_forwarded_for; - if (xfwd != NULL && ctx->proxies != NULL) { - (void) ngx_http_get_forwarded_addr(r, addr, xfwd->value.data, - xfwd->value.len, ctx->proxies, - ctx->proxy_recursive); + if (xfwd->nelts > 0 && ctx->proxies != NULL) { + (void) ngx_http_get_forwarded_addr(r, addr, xfwd, NULL, + ctx->proxies, ctx->proxy_recursive); } return NGX_OK; |