diff src/http/modules/ngx_http_userid_filter_module.c @ 362:54fad6c4b555 NGINX_0_6_25

nginx 0.6.25 *) Change: now the "server_name_in_redirect" directive is used instead of the "server_name" directive's special "*" parameter. *) Change: now wildcard and regex names can be used as main name in a "server_name" directive. *) Change: the "satisfy_any" directive was replaced by the "satisfy" directive. *) Workaround: old worker processes might hog CPU after reconfiguration if they was run under Linux OpenVZ. *) Feature: the "min_delete_depth" directive. *) Bugfix: the COPY and MOVE methods did not work with single files. *) Bugfix: the ngx_http_gzip_static_module did not allow the ngx_http_dav_module to work; bug appeared in 0.6.23. *) Bugfix: socket leak in HTTPS mode if deferred accept was used. Thanks to Ben Maurer. *) Bugfix: nginx could not be built without PCRE library; bug appeared in 0.6.23.
author Igor Sysoev <http://sysoev.ru>
date Tue, 08 Jan 2008 00:00:00 +0300
parents e10168d6e371
children edf1cb6c328e
line wrap: on
line diff
--- 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
 
         } 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);