aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-02-17 21:06:47 +0000
committerIgor Sysoev <igor@sysoev.ru>2007-02-17 21:06:47 +0000
commitcf72935bc3b76fcf103d7728b6f0cfb807cc1984 (patch)
tree3f7b54179794e19d71b46895518967e9dc744141
parentb4123b94ff3fe732c7df33ba6c010f0137d7d6e5 (diff)
downloadnginx-cf72935bc3b76fcf103d7728b6f0cfb807cc1984.tar.gz
nginx-cf72935bc3b76fcf103d7728b6f0cfb807cc1984.zip
a client address must be allocated from a connection pool
to live through the keep-alive requests
-rw-r--r--src/http/modules/ngx_http_realip_module.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_realip_module.c b/src/http/modules/ngx_http_realip_module.c
index bd5c31cdc..ffb2028bf 100644
--- 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_t *r)
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;
}