diff options
author | Igor Sysoev <igor@sysoev.ru> | 2007-12-29 16:00:34 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2007-12-29 16:00:34 +0000 |
commit | c7a9b7a990b4ea9bf908402abf090e1bd95b1d9a (patch) | |
tree | 1925f604f61085a6d50a42737c580756f377e4b6 /src/http/ngx_http_request.c | |
parent | 3f24ae2be259ee1be922ebb65d29c5aea8abb394 (diff) | |
download | nginx-c7a9b7a990b4ea9bf908402abf090e1bd95b1d9a.tar.gz nginx-c7a9b7a990b4ea9bf908402abf090e1bd95b1d9a.zip |
use ngx_http_server_addr()
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r-- | src/http/ngx_http_request.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 16f82c903..d4ddf4586 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -220,9 +220,7 @@ static void ngx_http_init_request(ngx_event_t *rev) { ngx_time_t *tp; - socklen_t len; ngx_uint_t i; - struct sockaddr_in sin; ngx_connection_t *c; ngx_http_request_t *r; ngx_http_in_port_t *hip; @@ -295,6 +293,8 @@ ngx_http_init_request(ngx_event_t *rev) i = 0; + r->connection = c; + if (hip->naddrs > 1) { /* @@ -302,7 +302,7 @@ ngx_http_init_request(ngx_event_t *rev) * is the "*:port" wildcard so getsockname() is needed to determine * the server address. * - * AcceptEx() already gave this address. + * AcceptEx() already has given this address. */ #if (NGX_WIN32) @@ -313,15 +313,10 @@ ngx_http_init_request(ngx_event_t *rev) } else #endif { - len = sizeof(struct sockaddr_in); - if (getsockname(c->fd, (struct sockaddr *) &sin, &len) == -1) { - ngx_connection_error(c, ngx_socket_errno, - "getsockname() failed"); + if (ngx_http_server_addr(r, NULL) != NGX_OK) { ngx_http_close_connection(c); return; } - - r->in_addr = sin.sin_addr.s_addr; } /* the last address is "*" */ @@ -426,8 +421,6 @@ ngx_http_init_request(ngx_event_t *rev) c->single_connection = 1; c->destroyed = 0; - r->connection = c; - r->main = r; tp = ngx_timeofday(); |