mirror of
https://github.com/nginx/nginx.git
synced 2025-06-08 02:02:38 +08:00
axe r->in_addr
This commit is contained in:
parent
b5a17c727c
commit
2d95c82f91
@ -360,10 +360,16 @@ static ngx_int_t
|
|||||||
ngx_http_userid_set_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
|
ngx_http_userid_set_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
|
||||||
ngx_http_userid_conf_t *conf)
|
ngx_http_userid_conf_t *conf)
|
||||||
{
|
{
|
||||||
u_char *cookie, *p;
|
u_char *cookie, *p;
|
||||||
size_t len;
|
size_t len;
|
||||||
ngx_str_t src, dst;
|
ngx_str_t src, dst;
|
||||||
ngx_table_elt_t *set_cookie, *p3p;
|
ngx_table_elt_t *set_cookie, *p3p;
|
||||||
|
ngx_connection_t *c;
|
||||||
|
struct sockaddr_in *sin;
|
||||||
|
#if (NGX_HAVE_INET6)
|
||||||
|
struct sockaddr_in6 *sin6;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: in the threaded mode the sequencers should be in TLS and their
|
* TODO: in the threaded mode the sequencers should be in TLS and their
|
||||||
* ranges should be divided between threads
|
* ranges should be divided between threads
|
||||||
@ -388,7 +394,28 @@ ngx_http_userid_set_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->uid_set[0] = htonl(r->in_addr);
|
c = r->connection;
|
||||||
|
|
||||||
|
switch (c->local_sockaddr->sa_family) {
|
||||||
|
|
||||||
|
#if (NGX_HAVE_INET6)
|
||||||
|
case AF_INET6:
|
||||||
|
sin6 = (struct sockaddr_in6 *) c->local_sockaddr;
|
||||||
|
|
||||||
|
p = (u_char *) &ctx->uid_set[0];
|
||||||
|
|
||||||
|
*p++ = sin6->sin6_addr.s6_addr[12];
|
||||||
|
*p++ = sin6->sin6_addr.s6_addr[13];
|
||||||
|
*p++ = sin6->sin6_addr.s6_addr[14];
|
||||||
|
*p = sin6->sin6_addr.s6_addr[15];
|
||||||
|
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default: /* AF_INET */
|
||||||
|
sin = (struct sockaddr_in *) c->local_sockaddr;
|
||||||
|
ctx->uid_set[0] = sin->sin_addr.s_addr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ctx->uid_set[0] = htonl(conf->service);
|
ctx->uid_set[0] = htonl(conf->service);
|
||||||
|
@ -1776,7 +1776,6 @@ ngx_http_server_addr(ngx_http_request_t *r, ngx_str_t *s)
|
|||||||
{
|
{
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
ngx_connection_t *c;
|
ngx_connection_t *c;
|
||||||
struct sockaddr_in *sin;
|
|
||||||
u_char sa[NGX_SOCKADDRLEN];
|
u_char sa[NGX_SOCKADDRLEN];
|
||||||
|
|
||||||
c = r->connection;
|
c = r->connection;
|
||||||
@ -1799,9 +1798,6 @@ ngx_http_server_addr(ngx_http_request_t *r, ngx_str_t *s)
|
|||||||
ngx_memcpy(c->local_sockaddr, &sa, len);
|
ngx_memcpy(c->local_sockaddr, &sa, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
sin = (struct sockaddr_in *) c->local_sockaddr;
|
|
||||||
r->in_addr = sin->sin_addr.s_addr;
|
|
||||||
|
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
@ -2065,7 +2061,6 @@ ngx_http_subrequest(ngx_http_request_t *r,
|
|||||||
c->data = sr;
|
c->data = sr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sr->in_addr = r->in_addr;
|
|
||||||
sr->port = r->port;
|
sr->port = r->port;
|
||||||
sr->port_text = r->port_text;
|
sr->port_text = r->port_text;
|
||||||
|
|
||||||
|
@ -373,7 +373,6 @@ ngx_http_init_request(ngx_event_t *rev)
|
|||||||
default: /* AF_INET */
|
default: /* AF_INET */
|
||||||
addr = port->addrs;
|
addr = port->addrs;
|
||||||
addr_conf = &addr[0].conf;
|
addr_conf = &addr[0].conf;
|
||||||
r->in_addr = addr[0].addr;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,6 @@ struct ngx_http_request_s {
|
|||||||
ngx_http_post_subrequest_t *post_subrequest;
|
ngx_http_post_subrequest_t *post_subrequest;
|
||||||
ngx_http_posted_request_t *posted_requests;
|
ngx_http_posted_request_t *posted_requests;
|
||||||
|
|
||||||
uint32_t in_addr;
|
|
||||||
ngx_uint_t port;
|
ngx_uint_t port;
|
||||||
ngx_str_t *port_text; /* ":80" */
|
ngx_str_t *port_text; /* ":80" */
|
||||||
ngx_http_virtual_names_t *virtual_names;
|
ngx_http_virtual_names_t *virtual_names;
|
||||||
|
Loading…
Reference in New Issue
Block a user