Mercurial > hg > nginx
diff src/http/ngx_http_header_filter_module.c @ 6593:b3b7e33083ac
Introduced ngx_inet_get_port() and ngx_inet_set_port() functions.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Mon, 20 Jun 2016 11:50:39 +0300 |
parents | 654d2dae97d3 |
children | d15172ebb400 |
line wrap: on
line diff
--- a/src/http/ngx_http_header_filter_module.c Mon Jun 20 10:41:17 2016 +0300 +++ b/src/http/ngx_http_header_filter_module.c Mon Jun 20 11:50:39 2016 +0300 @@ -161,10 +161,6 @@ ngx_connection_t *c; ngx_http_core_loc_conf_t *clcf; ngx_http_core_srv_conf_t *cscf; - struct sockaddr_in *sin; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif u_char addr[NGX_SOCKADDR_STRLEN]; if (r->header_sent) { @@ -333,24 +329,7 @@ } } - switch (c->local_sockaddr->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = (struct sockaddr_in6 *) c->local_sockaddr; - port = ntohs(sin6->sin6_port); - break; -#endif -#if (NGX_HAVE_UNIX_DOMAIN) - case AF_UNIX: - port = 0; - break; -#endif - default: /* AF_INET */ - sin = (struct sockaddr_in *) c->local_sockaddr; - port = ntohs(sin->sin_port); - break; - } + port = ngx_inet_get_port(c->local_sockaddr); len += sizeof("Location: https://") - 1 + host.len