Mercurial > hg > nginx-vendor-current
comparison src/http/modules/ngx_http_limit_req_module.c @ 664:f5b859b2f097 NGINX_1_1_16
nginx 1.1.16
*) Change: the simultaneous subrequest limit has been raised to 200.
*) Feature: the "from" parameter of the "disable_symlinks" directive.
*) Feature: the "return" and "error_page" directives can be used to
return 307 redirections.
*) Bugfix: a segmentation fault might occur in a worker process if the
"resolver" directive was used and there was no "error_log" directive
specified at global level.
Thanks to Roman Arutyunyan.
*) Bugfix: a segmentation fault might occur in a worker process if the
"proxy_http_version 1.1" or "fastcgi_keep_conn on" directives were
used.
*) Bugfix: memory leaks.
Thanks to Lanshun Zhou.
*) Bugfix: in the "disable_symlinks" directive.
*) Bugfix: on ZFS filesystem disk cache size might be calculated
incorrectly; the bug had appeared in 1.0.1.
*) Bugfix: nginx could not be built by the icc 12.1 compiler.
*) Bugfix: nginx could not be built by gcc on Solaris; the bug had
appeared in 1.1.15.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 29 Feb 2012 00:00:00 +0400 |
parents | d0f7a625f27c |
children | 660139fd80ca |
comparison
equal
deleted
inserted
replaced
663:dd668cf20818 | 664:f5b859b2f097 |
---|---|
119 NULL, /* init main configuration */ | 119 NULL, /* init main configuration */ |
120 | 120 |
121 NULL, /* create server configuration */ | 121 NULL, /* create server configuration */ |
122 NULL, /* merge server configuration */ | 122 NULL, /* merge server configuration */ |
123 | 123 |
124 ngx_http_limit_req_create_conf, /* create location configration */ | 124 ngx_http_limit_req_create_conf, /* create location configuration */ |
125 ngx_http_limit_req_merge_conf /* merge location configration */ | 125 ngx_http_limit_req_merge_conf /* merge location configuration */ |
126 }; | 126 }; |
127 | 127 |
128 | 128 |
129 ngx_module_t ngx_http_limit_req_module = { | 129 ngx_module_t ngx_http_limit_req_module = { |
130 NGX_MODULE_V1, | 130 NGX_MODULE_V1, |
383 continue; | 383 continue; |
384 } | 384 } |
385 | 385 |
386 /* hash == node->key */ | 386 /* hash == node->key */ |
387 | 387 |
388 do { | 388 lr = (ngx_http_limit_req_node_t *) &node->color; |
389 lr = (ngx_http_limit_req_node_t *) &node->color; | 389 |
390 | 390 rc = ngx_memn2cmp(data, lr->data, len, (size_t) lr->len); |
391 rc = ngx_memn2cmp(data, lr->data, len, (size_t) lr->len); | 391 |
392 | 392 if (rc == 0) { |
393 if (rc == 0) { | 393 ngx_queue_remove(&lr->queue); |
394 ngx_queue_remove(&lr->queue); | 394 ngx_queue_insert_head(&ctx->sh->queue, &lr->queue); |
395 ngx_queue_insert_head(&ctx->sh->queue, &lr->queue); | 395 |
396 | 396 ms = (ngx_msec_int_t) (now - lr->last); |
397 ms = (ngx_msec_int_t) (now - lr->last); | 397 |
398 | 398 excess = lr->excess - ctx->rate * ngx_abs(ms) / 1000 + 1000; |
399 excess = lr->excess - ctx->rate * ngx_abs(ms) / 1000 + 1000; | 399 |
400 | 400 if (excess < 0) { |
401 if (excess < 0) { | 401 excess = 0; |
402 excess = 0; | 402 } |
403 } | 403 |
404 | 404 *ep = excess; |
405 *ep = excess; | 405 |
406 | 406 if ((ngx_uint_t) excess > limit->burst) { |
407 if ((ngx_uint_t) excess > limit->burst) { | 407 return NGX_BUSY; |
408 return NGX_BUSY; | 408 } |
409 } | 409 |
410 | 410 if (account) { |
411 if (account) { | 411 lr->excess = excess; |
412 lr->excess = excess; | 412 lr->last = now; |
413 lr->last = now; | 413 return NGX_OK; |
414 return NGX_OK; | 414 } |
415 } | 415 |
416 | 416 lr->count++; |
417 lr->count++; | 417 |
418 | 418 ctx->node = lr; |
419 ctx->node = lr; | 419 |
420 | 420 return NGX_AGAIN; |
421 return NGX_AGAIN; | 421 } |
422 } | 422 |
423 | 423 node = (rc < 0) ? node->left : node->right; |
424 node = (rc < 0) ? node->left : node->right; | |
425 | |
426 } while (node != sentinel && hash == node->key); | |
427 | |
428 break; | |
429 } | 424 } |
430 | 425 |
431 *ep = 0; | 426 *ep = 0; |
432 | 427 |
433 size = offsetof(ngx_rbtree_node_t, color) | 428 size = offsetof(ngx_rbtree_node_t, color) |