a bug in limit_request module
Valentin V. Bartenev
ne at vbart.ru
Wed Aug 22 14:55:04 UTC 2012
On Wednesday 22 August 2012 17:49:52 chen cw wrote:
> Hi,
> The red-black tree used in limit_request module has two level of
> keys, the top is hash, and the next is the value string itself. However,
> when inserting a new node into the tree, only hash is set, the value string
> is left empty, [...]
>
Nice catch. Thank you.
wbr, Valentin V. Bartenev
Index: src/http/modules/ngx_http_limit_req_module.c
===================================================================
--- src/http/modules/ngx_http_limit_req_module.c (revision 4826)
+++ src/http/modules/ngx_http_limit_req_module.c (working copy)
@@ -444,17 +444,17 @@ ngx_http_limit_req_lookup(ngx_http_limit_req_limit
node->key = hash;
- ngx_rbtree_insert(&ctx->sh->rbtree, node);
-
lr = (ngx_http_limit_req_node_t *) &node->color;
- ngx_queue_insert_head(&ctx->sh->queue, &lr->queue);
-
lr->len = (u_char) len;
lr->excess = 0;
ngx_memcpy(lr->data, data, len);
+ ngx_rbtree_insert(&ctx->sh->rbtree, node);
+
+ ngx_queue_insert_head(&ctx->sh->queue, &lr->queue);
+
if (account) {
lr->last = now;
lr->count = 0;
More information about the nginx-devel
mailing list