# HG changeset patch # User Igor Sysoev # Date 1171746407 0 # Node ID cec2866f29bdf9619dae52d8cefc125be418b0a5 # Parent f8d6894f09908ffe927392be8b4eb58f2ac627b1 a client address must be allocated from a connection pool to live through the keep-alive requests diff --git a/src/http/modules/ngx_http_realip_module.c b/src/http/modules/ngx_http_realip_module.c --- a/src/http/modules/ngx_http_realip_module.c +++ b/src/http/modules/ngx_http_realip_module.c @@ -163,10 +163,17 @@ ngx_http_realip_handler(ngx_http_request return NGX_DECLINED; } + p = ngx_palloc(r->connection->pool, len); + if (p == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + ngx_memcpy(p, ip, len); + sin->sin_addr.s_addr = addr; r->connection->addr_text.len = len; - r->connection->addr_text.data = ip; + r->connection->addr_text.data = p; return NGX_DECLINED; }