comparison src/http/modules/ngx_http_realip_module.c @ 5263:05ba5bce31e0

Core: extended ngx_sock_ntop() with socklen parameter. On Linux, sockaddr length is required to process unix socket addresses properly due to unnamed sockets (which don't have sun_path set at all) and abstract namespace sockets.
author Vladimir Homutov <vl@nginx.com>
date Thu, 11 Jul 2013 16:07:25 +0400
parents f7fe817c92a2
children 3a72b1805c52
comparison
equal deleted inserted replaced
5262:626f288fa5ed 5263:05ba5bce31e0
228 ctx = cln->data; 228 ctx = cln->data;
229 ngx_http_set_ctx(r, ctx, ngx_http_realip_module); 229 ngx_http_set_ctx(r, ctx, ngx_http_realip_module);
230 230
231 c = r->connection; 231 c = r->connection;
232 232
233 len = ngx_sock_ntop(addr->sockaddr, text, NGX_SOCKADDR_STRLEN, 0); 233 len = ngx_sock_ntop(addr->sockaddr, addr->socklen, text,
234 NGX_SOCKADDR_STRLEN, 0);
234 if (len == 0) { 235 if (len == 0) {
235 return NGX_HTTP_INTERNAL_SERVER_ERROR; 236 return NGX_HTTP_INTERNAL_SERVER_ERROR;
236 } 237 }
237 238
238 p = ngx_pnalloc(c->pool, len); 239 p = ngx_pnalloc(c->pool, len);