changeset 1118:cec2866f29bd

a client address must be allocated from a connection pool to live through the keep-alive requests
author Igor Sysoev <igor@sysoev.ru>
date Sat, 17 Feb 2007 21:06:47 +0000
parents f8d6894f0990
children bd796ef5c9c9
files src/http/modules/ngx_http_realip_module.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;
         }