Mercurial > hg > nginx
diff src/http/ngx_http_variables.c @ 5464:30e806b8636a
Fixed handling of UNIX-domain sockets.
When evaluating $local_port, $server_port, and $server_addr,
UNIX-domain sockets were mistakenly interpreted as IPv4 sockets.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Mon, 09 Dec 2013 10:16:44 +0400 |
parents | c21e341c51cb |
children | 3a72b1805c52 |
line wrap: on
line diff
--- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -1185,6 +1185,12 @@ ngx_http_variable_remote_port(ngx_http_r break; #endif +#if (NGX_HAVE_UNIX_DOMAIN) + case AF_UNIX: + port = 0; + break; +#endif + default: /* AF_INET */ sin = (struct sockaddr_in *) r->connection->sockaddr; port = ntohs(sin->sin_port); @@ -1263,6 +1269,12 @@ ngx_http_variable_server_port(ngx_http_r break; #endif +#if (NGX_HAVE_UNIX_DOMAIN) + case AF_UNIX: + port = 0; + break; +#endif + default: /* AF_INET */ sin = (struct sockaddr_in *) r->connection->local_sockaddr; port = ntohs(sin->sin_port);