mirror of
https://github.com/nginx/nginx.git
synced 2024-11-27 15:39:01 +08:00
Fixed handling of UNIX-domain sockets.
When evaluating $local_port, $server_port, and $server_addr, UNIX-domain sockets were mistakenly interpreted as IPv4 sockets.
This commit is contained in:
parent
675e73e3bd
commit
fa512fdb76
@ -1095,6 +1095,12 @@ ngx_connection_local_sockaddr(ngx_connection_t *c, ngx_str_t *s,
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if (NGX_HAVE_UNIX_DOMAIN)
|
||||
case AF_UNIX:
|
||||
addr = 1;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default: /* AF_INET */
|
||||
sin = (struct sockaddr_in *) c->local_sockaddr;
|
||||
addr = sin->sin_addr.s_addr;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user