Latest update - 7624
This commit is contained in:
@@ -2681,11 +2681,15 @@ ngx_http_get_forwarded_addr_internal(ngx_http_request_t *r, ngx_addr_t *addr,
|
|||||||
u_char *xff, size_t xfflen, ngx_array_t *proxies, int recursive)
|
u_char *xff, size_t xfflen, ngx_array_t *proxies, int recursive)
|
||||||
{
|
{
|
||||||
u_char *p;
|
u_char *p;
|
||||||
ngx_int_t rc;
|
|
||||||
ngx_addr_t paddr;
|
ngx_addr_t paddr;
|
||||||
|
ngx_uint_t found;
|
||||||
|
|
||||||
|
found = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
|
||||||
if (ngx_cidr_match(addr->sockaddr, proxies) != NGX_OK) {
|
if (ngx_cidr_match(addr->sockaddr, proxies) != NGX_OK) {
|
||||||
return NGX_DECLINED;
|
return found ? NGX_DONE : NGX_DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = xff + xfflen - 1; p > xff; p--, xfflen--) {
|
for (p = xff + xfflen - 1; p > xff; p--, xfflen--) {
|
||||||
@@ -2701,23 +2705,17 @@ ngx_http_get_forwarded_addr_internal(ngx_http_request_t *r, ngx_addr_t *addr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_parse_addr_port(r->pool, &paddr, p, xfflen - (p - xff)) != NGX_OK) {
|
if (ngx_parse_addr_port(r->pool, &paddr, p, xfflen - (p - xff))
|
||||||
return NGX_DECLINED;
|
!= NGX_OK)
|
||||||
|
{
|
||||||
|
return found ? NGX_DONE : NGX_DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
*addr = paddr;
|
*addr = paddr;
|
||||||
|
found = 1;
|
||||||
|
xfflen = p - 1 - xff;
|
||||||
|
|
||||||
if (recursive && p > xff) {
|
} while (recursive && p > xff);
|
||||||
rc = ngx_http_get_forwarded_addr_internal(r, addr, xff, p - 1 - xff,
|
|
||||||
proxies, 1);
|
|
||||||
|
|
||||||
if (rc == NGX_DECLINED) {
|
|
||||||
return NGX_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* rc == NGX_OK || rc == NGX_DONE */
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user