comparison src/http/modules/ngx_http_limit_zone_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
94 NULL, /* init main configuration */ 94 NULL, /* init main configuration */
95 95
96 NULL, /* create server configuration */ 96 NULL, /* create server configuration */
97 NULL, /* merge server configuration */ 97 NULL, /* merge server configuration */
98 98
99 ngx_http_limit_zone_create_conf, /* create location configration */ 99 ngx_http_limit_zone_create_conf, /* create location configuration */
100 ngx_http_limit_zone_merge_conf /* merge location configration */ 100 ngx_http_limit_zone_merge_conf /* merge location configuration */
101 }; 101 };
102 102
103 103
104 ngx_module_t ngx_http_limit_zone_module = { 104 ngx_module_t ngx_http_limit_zone_module = {
105 NGX_MODULE_V1, 105 NGX_MODULE_V1,
192 continue; 192 continue;
193 } 193 }
194 194
195 /* hash == node->key */ 195 /* hash == node->key */
196 196
197 do { 197 lz = (ngx_http_limit_zone_node_t *) &node->color;
198 lz = (ngx_http_limit_zone_node_t *) &node->color; 198
199 199 rc = ngx_memn2cmp(vv->data, lz->data, len, (size_t) lz->len);
200 rc = ngx_memn2cmp(vv->data, lz->data, len, (size_t) lz->len); 200
201 201 if (rc == 0) {
202 if (rc == 0) { 202 if ((ngx_uint_t) lz->conn < lzcf->conn) {
203 if ((ngx_uint_t) lz->conn < lzcf->conn) { 203 lz->conn++;
204 lz->conn++; 204 goto done;
205 goto done;
206 }
207
208 ngx_shmtx_unlock(&shpool->mutex);
209
210 ngx_log_error(lzcf->log_level, r->connection->log, 0,
211 "limiting connections by zone \"%V\"",
212 &lzcf->shm_zone->shm.name);
213
214 return NGX_HTTP_SERVICE_UNAVAILABLE;
215 } 205 }
216 206
217 node = (rc < 0) ? node->left : node->right; 207 ngx_shmtx_unlock(&shpool->mutex);
218 208
219 } while (node != sentinel && hash == node->key); 209 ngx_log_error(lzcf->log_level, r->connection->log, 0,
220 210 "limiting connections by zone \"%V\"",
221 break; 211 &lzcf->shm_zone->shm.name);
212
213 return NGX_HTTP_SERVICE_UNAVAILABLE;
214 }
215
216 node = (rc < 0) ? node->left : node->right;
222 } 217 }
223 218
224 n = offsetof(ngx_rbtree_node_t, color) 219 n = offsetof(ngx_rbtree_node_t, color)
225 + offsetof(ngx_http_limit_zone_node_t, data) 220 + offsetof(ngx_http_limit_zone_node_t, data)
226 + len; 221 + len;