diff src/http/modules/ngx_http_limit_zone_module.c @ 426:e7dbea1ee115 NGINX_0_7_25

nginx 0.7.25 *) Change: in subrequest processing. *) Change: now POSTs without "Content-Length" header line are allowed. *) Bugfix: now the "limit_req" and "limit_conn" directives log a prohibition reason. *) Bugfix: in the "delete" parameter of the "geo" directive.
author Igor Sysoev <http://sysoev.ru>
date Mon, 08 Dec 2008 00:00:00 +0300
parents b743d290eb3b
children 56baf312c1b5
line wrap: on
line diff
--- a/src/http/modules/ngx_http_limit_zone_module.c
+++ b/src/http/modules/ngx_http_limit_zone_module.c
@@ -189,6 +189,10 @@ ngx_http_limit_zone_handler(ngx_http_req
 
                 ngx_shmtx_unlock(&shpool->mutex);
 
+                ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                              "limiting connections by zone \"%V\"",
+                              &lzcf->shm_zone->name);
+
                 return NGX_HTTP_SERVICE_UNAVAILABLE;
             }
 
@@ -206,6 +210,11 @@ ngx_http_limit_zone_handler(ngx_http_req
     node = ngx_slab_alloc_locked(shpool, n);
     if (node == NULL) {
         ngx_shmtx_unlock(&shpool->mutex);
+
+        ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
+                      "could not allocate memory in zone \"%V\"",
+                      &lzcf->shm_zone->name);
+
         return NGX_HTTP_SERVICE_UNAVAILABLE;
     }
 
@@ -462,6 +471,10 @@ ngx_http_limit_conn(ngx_conf_t *cf, ngx_
     ngx_int_t   n;
     ngx_str_t  *value;
 
+    if (lzcf->shm_zone) {
+        return "is duplicate";
+    }
+
     value = cf->args->elts;
 
     lzcf->shm_zone = ngx_shared_memory_add(cf, &value[1], 0,