Mercurial > hg > nginx-vendor-1-0
comparison src/http/modules/ngx_http_limit_req_module.c @ 646:09a689c5e494 NGINX_1_0_13
nginx 1.0.13
*) Feature: the "return" and "error_page" directives can now 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: memory leaks.
Thanks to Lanshun Zhou.
*) Bugfix: nginx might log incorrect error "upstream prematurely closed
connection" instead of correct "upstream sent too big header" one.
Thanks to Feibo Li.
*) Bugfix: on ZFS filesystem disk cache size might be calculated
incorrectly; the bug had appeared in 1.0.1.
*) Bugfix: the number of internal redirects to named locations was not
limited.
*) Bugfix: temporary files might be not removed if the "proxy_store"
directive was used with SSI includes.
*) Bugfix: in some cases non-cacheable variables (such as the $args
variable) returned old empty cached value.
*) Bugfix: the "proxy_redirect" directives might be inherited
incorrectly.
*) Bugfix: nginx could not be built with the ngx_http_perl_module if the
--with-openssl option was used.
*) Bugfix: nginx could not be built by the icc 12.1 compiler.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 05 Mar 2012 00:00:00 +0400 |
parents | ad25218fd14b |
children |
comparison
equal
deleted
inserted
replaced
645:60344e6faa47 | 646:09a689c5e494 |
---|---|
110 NULL, /* init main configuration */ | 110 NULL, /* init main configuration */ |
111 | 111 |
112 NULL, /* create server configuration */ | 112 NULL, /* create server configuration */ |
113 NULL, /* merge server configuration */ | 113 NULL, /* merge server configuration */ |
114 | 114 |
115 ngx_http_limit_req_create_conf, /* create location configration */ | 115 ngx_http_limit_req_create_conf, /* create location configuration */ |
116 ngx_http_limit_req_merge_conf /* merge location configration */ | 116 ngx_http_limit_req_merge_conf /* merge location configuration */ |
117 }; | 117 }; |
118 | 118 |
119 | 119 |
120 ngx_module_t ngx_http_limit_req_module = { | 120 ngx_module_t ngx_http_limit_req_module = { |
121 NGX_MODULE_V1, | 121 NGX_MODULE_V1, |
370 continue; | 370 continue; |
371 } | 371 } |
372 | 372 |
373 /* hash == node->key */ | 373 /* hash == node->key */ |
374 | 374 |
375 do { | 375 lr = (ngx_http_limit_req_node_t *) &node->color; |
376 lr = (ngx_http_limit_req_node_t *) &node->color; | 376 |
377 | 377 rc = ngx_memn2cmp(data, lr->data, len, (size_t) lr->len); |
378 rc = ngx_memn2cmp(data, lr->data, len, (size_t) lr->len); | 378 |
379 | 379 if (rc == 0) { |
380 if (rc == 0) { | 380 ngx_queue_remove(&lr->queue); |
381 ngx_queue_remove(&lr->queue); | 381 ngx_queue_insert_head(&ctx->sh->queue, &lr->queue); |
382 ngx_queue_insert_head(&ctx->sh->queue, &lr->queue); | 382 |
383 | 383 tp = ngx_timeofday(); |
384 tp = ngx_timeofday(); | 384 |
385 | 385 now = (ngx_msec_t) (tp->sec * 1000 + tp->msec); |
386 now = (ngx_msec_t) (tp->sec * 1000 + tp->msec); | 386 ms = (ngx_msec_int_t) (now - lr->last); |
387 ms = (ngx_msec_int_t) (now - lr->last); | 387 |
388 | 388 excess = lr->excess - ctx->rate * ngx_abs(ms) / 1000 + 1000; |
389 excess = lr->excess - ctx->rate * ngx_abs(ms) / 1000 + 1000; | 389 |
390 | 390 if (excess < 0) { |
391 if (excess < 0) { | 391 excess = 0; |
392 excess = 0; | 392 } |
393 } | 393 |
394 | 394 *ep = excess; |
395 *ep = excess; | 395 |
396 | 396 if ((ngx_uint_t) excess > lrcf->burst) { |
397 if ((ngx_uint_t) excess > lrcf->burst) { | 397 return NGX_BUSY; |
398 return NGX_BUSY; | 398 } |
399 } | 399 |
400 | 400 lr->excess = excess; |
401 lr->excess = excess; | 401 lr->last = now; |
402 lr->last = now; | 402 |
403 | 403 if (excess) { |
404 if (excess) { | 404 return NGX_AGAIN; |
405 return NGX_AGAIN; | 405 } |
406 } | 406 |
407 | 407 return NGX_OK; |
408 return NGX_OK; | 408 } |
409 } | 409 |
410 | 410 node = (rc < 0) ? node->left : node->right; |
411 node = (rc < 0) ? node->left : node->right; | |
412 | |
413 } while (node != sentinel && hash == node->key); | |
414 | |
415 break; | |
416 } | 411 } |
417 | 412 |
418 *ep = 0; | 413 *ep = 0; |
419 | 414 |
420 return NGX_DECLINED; | 415 return NGX_DECLINED; |