]> git.kaiwu.me - nginx.git/commitdiff
a client address must be allocated from a connection pool
authorIgor Sysoev <igor@sysoev.ru>
Sat, 17 Feb 2007 21:06:47 +0000 (21:06 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sat, 17 Feb 2007 21:06:47 +0000 (21:06 +0000)
to live through the keep-alive requests

src/http/modules/ngx_http_realip_module.c

index bd5c31cdce4794889e3ac844c7a801acacff72a5..ffb2028bf5c384c70009790dc19d8b16e31894ac 100644 (file)
@@ -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;
         }