diff src/event/ngx_event.c @ 214:0ad9eeb6ac7f NGINX_0_3_54

nginx 0.3.54 *) 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; bug appeared in 0.3.53.
author Igor Sysoev <http://sysoev.ru>
date Tue, 11 Jul 2006 00:00:00 +0400
parents 56688ed172c8
children fa32d59d9a15
line wrap: on
line diff
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -1035,22 +1035,30 @@ ngx_event_debug_connection(ngx_conf_t *c
 #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 *c
         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;
     }