comparison src/http/modules/ngx_http_realip_module.c @ 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 3f354952e91d
children b590a528fd41
comparison
equal deleted inserted replaced
1117:f8d6894f0990 1118:cec2866f29bd
161 161
162 if (addr == INADDR_NONE) { 162 if (addr == INADDR_NONE) {
163 return NGX_DECLINED; 163 return NGX_DECLINED;
164 } 164 }
165 165
166 p = ngx_palloc(r->connection->pool, len);
167 if (p == NULL) {
168 return NGX_HTTP_INTERNAL_SERVER_ERROR;
169 }
170
171 ngx_memcpy(p, ip, len);
172
166 sin->sin_addr.s_addr = addr; 173 sin->sin_addr.s_addr = addr;
167 174
168 r->connection->addr_text.len = len; 175 r->connection->addr_text.len = len;
169 r->connection->addr_text.data = ip; 176 r->connection->addr_text.data = p;
170 177
171 return NGX_DECLINED; 178 return NGX_DECLINED;
172 } 179 }
173 } 180 }
174 181