From bb28b6d3a455c20077a7e2d7319c24e484694a72 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Tue, 11 Jul 2006 13:20:19 +0000 Subject: nginx-0.3.54-RELEASE import *) Feature: nginx now logs the subrequest information to the error log. *) Feature: the "proxy_next_upstream", "fastcgi_next_upstream", and "memcached_next_upstream" directives support the "off" parameter. *) Feature: the "debug_connection" directive supports the CIDR address form. *) Bugfix: if a response of proxied server or FastCGI server was converted from UTF-8 or back, then it may be transferred incomplete. *) Bugfix: the $upstream_response_time variable had the time of the first request to a backend only. *) Bugfix: nginx could not be built on amd64 platform; the bug had appeared in 0.3.53. --- src/event/ngx_event.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src/event/ngx_event.c') diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c index 7dc15623a..7d4cdbad6 100644 --- a/src/event/ngx_event.c +++ b/src/event/ngx_event.c @@ -1035,22 +1035,30 @@ ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) #if (NGX_DEBUG) ngx_event_conf_t *ecf = conf; - in_addr_t *addr; - ngx_str_t *value; - struct hostent *h; + ngx_event_debug_t *dc; + ngx_str_t *value; + struct hostent *h; + ngx_inet_cidr_t in_cidr; value = cf->args->elts; /* AF_INET only */ - addr = ngx_array_push(&ecf->debug_connection); - if (addr == NULL) { + dc = ngx_array_push(&ecf->debug_connection); + if (dc == NULL) { return NGX_CONF_ERROR; } - *addr = inet_addr((char *) value[1].data); + dc->addr = inet_addr((char *) value[1].data); - if (*addr != INADDR_NONE) { + if (dc->addr != INADDR_NONE) { + dc->mask = 0xffffffff; + return NGX_OK; + } + + if (ngx_ptocidr(&value[1], &in_cidr) == NGX_OK) { + dc->mask = in_cidr.mask; + dc->addr = in_cidr.addr; return NGX_OK; } @@ -1062,7 +1070,8 @@ ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } - *addr = *(in_addr_t *)(h->h_addr_list[0]); + dc->mask = 0xffffffff; + dc->addr = *(in_addr_t *)(h->h_addr_list[0]); #else @@ -1096,7 +1105,7 @@ ngx_event_create_conf(ngx_cycle_t *cycle) #if (NGX_DEBUG) if (ngx_array_init(&ecf->debug_connection, cycle->pool, 4, - sizeof(in_addr_t)) == NGX_ERROR) + sizeof(ngx_event_debug_t)) == NGX_ERROR) { return NGX_CONF_ERROR; } -- cgit