summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-12-29 16:00:34 +0000
committerIgor Sysoev <igor@sysoev.ru>2007-12-29 16:00:34 +0000
commitc7a9b7a990b4ea9bf908402abf090e1bd95b1d9a (patch)
tree1925f604f61085a6d50a42737c580756f377e4b6 /src/http/modules
parent3f24ae2be259ee1be922ebb65d29c5aea8abb394 (diff)
downloadnginx-c7a9b7a990b4ea9bf908402abf090e1bd95b1d9a.tar.gz
nginx-c7a9b7a990b4ea9bf908402abf090e1bd95b1d9a.tar.bz2
use ngx_http_server_addr()
Diffstat (limited to 'src/http/modules')
-rw-r--r--src/http/modules/ngx_http_userid_filter_module.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/http/modules/ngx_http_userid_filter_module.c b/src/http/modules/ngx_http_userid_filter_module.c
index e13393dc2..98cff7e91 100644
--- a/src/http/modules/ngx_http_userid_filter_module.c
+++ b/src/http/modules/ngx_http_userid_filter_module.c
@@ -300,12 +300,10 @@ static ngx_int_t
ngx_http_userid_set_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
ngx_http_userid_conf_t *conf)
{
- u_char *cookie, *p;
- size_t len;
- socklen_t slen;
- struct sockaddr_in sin;
- ngx_str_t src, dst;
- ngx_table_elt_t *set_cookie, *p3p;
+ u_char *cookie, *p;
+ size_t len;
+ ngx_str_t src, dst;
+ ngx_table_elt_t *set_cookie, *p3p;
/*
* TODO: in the threaded mode the sequencers should be in TLS and their
@@ -327,18 +325,8 @@ ngx_http_userid_set_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
} else {
if (conf->service == NGX_CONF_UNSET) {
- if (r->in_addr == 0) {
- slen = sizeof(struct sockaddr_in);
- if (getsockname(r->connection->fd,
- (struct sockaddr *) &sin, &slen)
- == -1)
- {
- ngx_connection_error(r->connection, ngx_socket_errno,
- "getsockname() failed");
- return NGX_ERROR;
- }
-
- r->in_addr = sin.sin_addr.s_addr;
+ if (ngx_http_server_addr(r, NULL) != NGX_OK) {
+ return NGX_ERROR;
}
ctx->uid_set[0] = htonl(r->in_addr);