Mercurial > hg > nginx-vendor-current
diff src/http/ngx_http_core_module.c @ 462:dcb6b5f9d526 NGINX_0_7_43
nginx 0.7.43
*) Bugfix: a request was handled incorrectly, if a "root" directive
used variables; the bug had appeared in 0.7.42.
*) Bugfix: if a server listened on wildcard address, then the
$server_addr variable value was "0.0.0.0"; the bug had appeared in
0.7.36.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 18 Mar 2009 00:00:00 +0300 |
parents | bb941a2996a6 |
children | c8cfb6c462ef |
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1688,7 +1688,9 @@ ngx_http_map_uri_to_path(ngx_http_reques last = ngx_copy(path->data, clcf->root.data, clcf->root.len); } else { - if (ngx_http_script_run(r, path, clcf->root_lengths->elts, ++reserved, + reserved += alias ? 1 : r->uri.len + 1; + + if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved, clcf->root_values->elts) == NULL) { @@ -1789,13 +1791,38 @@ ngx_http_auth_basic_user(ngx_http_reques ngx_int_t ngx_http_server_addr(ngx_http_request_t *r, ngx_str_t *s) { - socklen_t len; - ngx_connection_t *c; - u_char sa[NGX_SOCKADDRLEN]; + socklen_t len; + ngx_uint_t addr; + ngx_connection_t *c; + u_char sa[NGX_SOCKADDRLEN]; + struct sockaddr_in *sin; +#if (NGX_HAVE_INET6) + ngx_uint_t i; + struct sockaddr_in6 *sin6; +#endif c = r->connection; - if (c->local_sockaddr == NULL) { + switch (c->local_sockaddr->sa_family) { + +#if (NGX_HAVE_INET6) + case AF_INET6: + sin6 = (struct sockaddr_in6 *) c->local_sockaddr; + + for (addr = 0, i = 0; addr == 0 && i < 16; i++) { + addr |= sin6->sin6_addr.s6_addr[i]; + } + + break; +#endif + + default: /* AF_INET */ + sin = (struct sockaddr_in *) c->local_sockaddr; + addr = sin->sin_addr.s_addr; + break; + } + + if (addr == 0) { len = NGX_SOCKADDRLEN;