aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_variables.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2013-12-09 10:16:44 +0400
committerRuslan Ermilov <ru@nginx.com>2013-12-09 10:16:44 +0400
commitfa512fdb7650b48826ef49754328980a6e357c9a (patch)
tree0687d9effe4f62626c583f4a8fd8326bdd817240 /src/http/ngx_http_variables.c
parent675e73e3bd70af7780ed8c9dde47d2d28a8a9f56 (diff)
downloadnginx-fa512fdb7650b48826ef49754328980a6e357c9a.tar.gz
nginx-fa512fdb7650b48826ef49754328980a6e357c9a.zip
Fixed handling of UNIX-domain sockets.
When evaluating $local_port, $server_port, and $server_addr, UNIX-domain sockets were mistakenly interpreted as IPv4 sockets.
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r--src/http/ngx_http_variables.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index e49d2023b..8b86d5a9a 100644
--- 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_request_t *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_request_t *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);