comparison 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
comparison
equal deleted inserted replaced
425:f64d9e30046c 426:e7dbea1ee115
187 goto done; 187 goto done;
188 } 188 }
189 189
190 ngx_shmtx_unlock(&shpool->mutex); 190 ngx_shmtx_unlock(&shpool->mutex);
191 191
192 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
193 "limiting connections by zone \"%V\"",
194 &lzcf->shm_zone->name);
195
192 return NGX_HTTP_SERVICE_UNAVAILABLE; 196 return NGX_HTTP_SERVICE_UNAVAILABLE;
193 } 197 }
194 198
195 node = (rc < 0) ? node->left : node->right; 199 node = (rc < 0) ? node->left : node->right;
196 200
204 + len; 208 + len;
205 209
206 node = ngx_slab_alloc_locked(shpool, n); 210 node = ngx_slab_alloc_locked(shpool, n);
207 if (node == NULL) { 211 if (node == NULL) {
208 ngx_shmtx_unlock(&shpool->mutex); 212 ngx_shmtx_unlock(&shpool->mutex);
213
214 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
215 "could not allocate memory in zone \"%V\"",
216 &lzcf->shm_zone->name);
217
209 return NGX_HTTP_SERVICE_UNAVAILABLE; 218 return NGX_HTTP_SERVICE_UNAVAILABLE;
210 } 219 }
211 220
212 lz = (ngx_http_limit_zone_node_t *) &node->color; 221 lz = (ngx_http_limit_zone_node_t *) &node->color;
213 222
460 ngx_http_limit_zone_conf_t *lzcf = conf; 469 ngx_http_limit_zone_conf_t *lzcf = conf;
461 470
462 ngx_int_t n; 471 ngx_int_t n;
463 ngx_str_t *value; 472 ngx_str_t *value;
464 473
474 if (lzcf->shm_zone) {
475 return "is duplicate";
476 }
477
465 value = cf->args->elts; 478 value = cf->args->elts;
466 479
467 lzcf->shm_zone = ngx_shared_memory_add(cf, &value[1], 0, 480 lzcf->shm_zone = ngx_shared_memory_add(cf, &value[1], 0,
468 &ngx_http_limit_zone_module); 481 &ngx_http_limit_zone_module);
469 if (lzcf->shm_zone == NULL) { 482 if (lzcf->shm_zone == NULL) {