# HG changeset patch # User Valentin Bartenev # Date 1321279482 0 # Node ID 91874133fb2729373a1f32404c0346cd8fe73555 # Parent 21167183825d5439ccd4b676b7bc018253decec2 Renamed ngx_http_limit_zone_module to ngx_http_limit_conn_module. diff --git a/auto/modules b/auto/modules --- a/auto/modules +++ b/auto/modules @@ -210,9 +210,9 @@ if [ $HTTP_ACCESS = YES ]; then HTTP_SRCS="$HTTP_SRCS $HTTP_ACCESS_SRCS" fi -if [ $HTTP_LIMIT_ZONE = YES ]; then - HTTP_MODULES="$HTTP_MODULES $HTTP_LIMIT_ZONE_MODULE" - HTTP_SRCS="$HTTP_SRCS $HTTP_LIMIT_ZONE_SRCS" +if [ $HTTP_LIMIT_CONN = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_LIMIT_CONN_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_LIMIT_CONN_SRCS" fi if [ $HTTP_LIMIT_REQ = YES ]; then diff --git a/auto/options b/auto/options --- a/auto/options +++ b/auto/options @@ -85,7 +85,7 @@ HTTP_UWSGI=YES HTTP_SCGI=YES HTTP_PERL=NO HTTP_MEMCACHED=YES -HTTP_LIMIT_ZONE=YES +HTTP_LIMIT_CONN=YES HTTP_LIMIT_REQ=YES HTTP_EMPTY_GIF=YES HTTP_BROWSER=YES @@ -143,6 +143,8 @@ NGX_LIBATOMIC=NO NGX_CPU_CACHE_LINE= +NGX_POST_CONF_MSG= + opt= for option @@ -227,7 +229,13 @@ do --without-http_uwsgi_module) HTTP_UWSGI=NO ;; --without-http_scgi_module) HTTP_SCGI=NO ;; --without-http_memcached_module) HTTP_MEMCACHED=NO ;; - --without-http_limit_zone_module) HTTP_LIMIT_ZONE=NO ;; + --without-http_limit_zone_module) + HTTP_LIMIT_CONN=NO + NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG +$0: warning: the \"--without-http_limit_zone_module\" option is deprecated, \ +use the \"--without-http_limit_conn_module\" option instead" + ;; + --without-http_limit_conn_module) HTTP_LIMIT_CONN=NO ;; --without-http_limit_req_module) HTTP_LIMIT_REQ=NO ;; --without-http_empty_gif_module) HTTP_EMPTY_GIF=NO ;; --without-http_browser_module) HTTP_BROWSER=NO ;; @@ -364,7 +372,7 @@ cat << END --without-http_uwsgi_module disable ngx_http_uwsgi_module --without-http_scgi_module disable ngx_http_scgi_module --without-http_memcached_module disable ngx_http_memcached_module - --without-http_limit_zone_module disable ngx_http_limit_zone_module + --without-http_limit_conn_module disable ngx_http_limit_conn_module --without-http_limit_req_module disable ngx_http_limit_req_module --without-http_empty_gif_module disable ngx_http_empty_gif_module --without-http_browser_module disable ngx_http_browser_module diff --git a/auto/sources b/auto/sources --- a/auto/sources +++ b/auto/sources @@ -435,8 +435,8 @@ HTTP_MEMCACHED_MODULE=ngx_http_memcached HTTP_MEMCACHED_SRCS=src/http/modules/ngx_http_memcached_module.c -HTTP_LIMIT_ZONE_MODULE=ngx_http_limit_zone_module -HTTP_LIMIT_ZONE_SRCS=src/http/modules/ngx_http_limit_zone_module.c +HTTP_LIMIT_CONN_MODULE=ngx_http_limit_conn_module +HTTP_LIMIT_CONN_SRCS=src/http/modules/ngx_http_limit_conn_module.c HTTP_LIMIT_REQ_MODULE=ngx_http_limit_req_module diff --git a/auto/summary b/auto/summary --- a/auto/summary +++ b/auto/summary @@ -111,3 +111,5 @@ fi if [ $HTTP_SCGI = YES ]; then echo " nginx http scgi temporary files: \"$NGX_HTTP_SCGI_TEMP_PATH\"" fi + +echo "$NGX_POST_CONF_MSG" diff --git a/src/http/modules/ngx_http_limit_zone_module.c b/src/http/modules/ngx_http_limit_conn_module.c rename from src/http/modules/ngx_http_limit_zone_module.c rename to src/http/modules/ngx_http_limit_conn_module.c --- a/src/http/modules/ngx_http_limit_zone_module.c +++ b/src/http/modules/ngx_http_limit_conn_module.c @@ -14,41 +14,41 @@ typedef struct { u_char len; u_short conn; u_char data[1]; -} ngx_http_limit_zone_node_t; +} ngx_http_limit_conn_node_t; typedef struct { ngx_shm_zone_t *shm_zone; ngx_rbtree_node_t *node; -} ngx_http_limit_zone_cleanup_t; +} ngx_http_limit_conn_cleanup_t; typedef struct { ngx_rbtree_t *rbtree; ngx_int_t index; ngx_str_t var; -} ngx_http_limit_zone_ctx_t; +} ngx_http_limit_conn_ctx_t; typedef struct { ngx_shm_zone_t *shm_zone; ngx_uint_t conn; -} ngx_http_limit_zone_limit_t; +} ngx_http_limit_conn_limit_t; typedef struct { ngx_array_t limits; ngx_uint_t log_level; -} ngx_http_limit_zone_conf_t; +} ngx_http_limit_conn_conf_t; -static ngx_rbtree_node_t *ngx_http_limit_zone_lookup(ngx_rbtree_t *rbtree, +static ngx_rbtree_node_t *ngx_http_limit_conn_lookup(ngx_rbtree_t *rbtree, ngx_http_variable_value_t *vv, uint32_t hash); -static void ngx_http_limit_zone_cleanup(void *data); -static ngx_inline void ngx_http_limit_zone_cleanup_all(ngx_pool_t *pool); +static void ngx_http_limit_conn_cleanup(void *data); +static ngx_inline void ngx_http_limit_conn_cleanup_all(ngx_pool_t *pool); -static void *ngx_http_limit_zone_create_conf(ngx_conf_t *cf); -static char *ngx_http_limit_zone_merge_conf(ngx_conf_t *cf, void *parent, +static void *ngx_http_limit_conn_create_conf(ngx_conf_t *cf); +static char *ngx_http_limit_conn_merge_conf(ngx_conf_t *cf, void *parent, void *child); static char *ngx_http_limit_conn_zone(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); @@ -56,7 +56,7 @@ static char *ngx_http_limit_zone(ngx_con void *conf); static char *ngx_http_limit_conn(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static ngx_int_t ngx_http_limit_zone_init(ngx_conf_t *cf); +static ngx_int_t ngx_http_limit_conn_init(ngx_conf_t *cf); static ngx_conf_deprecated_t ngx_conf_deprecated_limit_zone = { @@ -73,7 +73,7 @@ static ngx_conf_enum_t ngx_http_limit_c }; -static ngx_command_t ngx_http_limit_zone_commands[] = { +static ngx_command_t ngx_http_limit_conn_commands[] = { { ngx_string("limit_conn_zone"), NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE2, @@ -100,16 +100,16 @@ static ngx_command_t ngx_http_limit_zon NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, ngx_conf_set_enum_slot, NGX_HTTP_LOC_CONF_OFFSET, - offsetof(ngx_http_limit_zone_conf_t, log_level), + offsetof(ngx_http_limit_conn_conf_t, log_level), &ngx_http_limit_conn_log_levels }, ngx_null_command }; -static ngx_http_module_t ngx_http_limit_zone_module_ctx = { +static ngx_http_module_t ngx_http_limit_conn_module_ctx = { NULL, /* preconfiguration */ - ngx_http_limit_zone_init, /* postconfiguration */ + ngx_http_limit_conn_init, /* postconfiguration */ NULL, /* create main configuration */ NULL, /* init main configuration */ @@ -117,15 +117,15 @@ static ngx_http_module_t ngx_http_limit NULL, /* create server configuration */ NULL, /* merge server configuration */ - ngx_http_limit_zone_create_conf, /* create location configration */ - ngx_http_limit_zone_merge_conf /* merge location configration */ + ngx_http_limit_conn_create_conf, /* create location configration */ + ngx_http_limit_conn_merge_conf /* merge location configration */ }; -ngx_module_t ngx_http_limit_zone_module = { +ngx_module_t ngx_http_limit_conn_module = { NGX_MODULE_V1, - &ngx_http_limit_zone_module_ctx, /* module context */ - ngx_http_limit_zone_commands, /* module directives */ + &ngx_http_limit_conn_module_ctx, /* module context */ + ngx_http_limit_conn_commands, /* module directives */ NGX_HTTP_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ @@ -139,7 +139,7 @@ ngx_module_t ngx_http_limit_zone_module static ngx_int_t -ngx_http_limit_zone_handler(ngx_http_request_t *r) +ngx_http_limit_conn_handler(ngx_http_request_t *r) { size_t len, n; uint32_t hash; @@ -148,22 +148,22 @@ ngx_http_limit_zone_handler(ngx_http_req ngx_rbtree_node_t *node; ngx_pool_cleanup_t *cln; ngx_http_variable_value_t *vv; - ngx_http_limit_zone_ctx_t *ctx; - ngx_http_limit_zone_node_t *lz; - ngx_http_limit_zone_conf_t *lzcf; - ngx_http_limit_zone_limit_t *limits; - ngx_http_limit_zone_cleanup_t *lzcln; + ngx_http_limit_conn_ctx_t *ctx; + ngx_http_limit_conn_node_t *lc; + ngx_http_limit_conn_conf_t *lccf; + ngx_http_limit_conn_limit_t *limits; + ngx_http_limit_conn_cleanup_t *lccln; - if (r->main->limit_zone_set) { + if (r->main->limit_conn_set) { return NGX_DECLINED; } - lzcf = ngx_http_get_module_loc_conf(r, ngx_http_limit_zone_module); - limits = lzcf->limits.elts; + r->main->limit_conn_set = 1; - r->main->limit_zone_set = 1; + lccf = ngx_http_get_module_loc_conf(r, ngx_http_limit_conn_module); + limits = lccf->limits.elts; - for (i = 0; i < lzcf->limits.nelts; i++) { + for (i = 0; i < lccf->limits.nelts; i++) { ctx = limits[i].shm_zone->data; vv = ngx_http_get_indexed_variable(r, ctx->index); @@ -192,66 +192,66 @@ ngx_http_limit_zone_handler(ngx_http_req ngx_shmtx_lock(&shpool->mutex); - node = ngx_http_limit_zone_lookup(ctx->rbtree, vv, hash); + node = ngx_http_limit_conn_lookup(ctx->rbtree, vv, hash); if (node == NULL) { n = offsetof(ngx_rbtree_node_t, color) - + offsetof(ngx_http_limit_zone_node_t, data) + + offsetof(ngx_http_limit_conn_node_t, data) + len; node = ngx_slab_alloc_locked(shpool, n); if (node == NULL) { ngx_shmtx_unlock(&shpool->mutex); - ngx_http_limit_zone_cleanup_all(r->pool); + ngx_http_limit_conn_cleanup_all(r->pool); return NGX_HTTP_SERVICE_UNAVAILABLE; } - lz = (ngx_http_limit_zone_node_t *) &node->color; + lc = (ngx_http_limit_conn_node_t *) &node->color; node->key = hash; - lz->len = (u_char) len; - lz->conn = 1; - ngx_memcpy(lz->data, vv->data, len); + lc->len = (u_char) len; + lc->conn = 1; + ngx_memcpy(lc->data, vv->data, len); ngx_rbtree_insert(ctx->rbtree, node); } else { - lz = (ngx_http_limit_zone_node_t *) &node->color; + lc = (ngx_http_limit_conn_node_t *) &node->color; - if ((ngx_uint_t) lz->conn >= limits[i].conn) { + if ((ngx_uint_t) lc->conn >= limits[i].conn) { ngx_shmtx_unlock(&shpool->mutex); - ngx_log_error(lzcf->log_level, r->connection->log, 0, + ngx_log_error(lccf->log_level, r->connection->log, 0, "limiting connections by zone \"%V\"", &limits[i].shm_zone->shm.name); - ngx_http_limit_zone_cleanup_all(r->pool); + ngx_http_limit_conn_cleanup_all(r->pool); return NGX_HTTP_SERVICE_UNAVAILABLE; } - lz->conn++; + lc->conn++; } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "limit zone: %08XD %d", node->key, lz->conn); + "limit zone: %08XD %d", node->key, lc->conn); ngx_shmtx_unlock(&shpool->mutex); cln = ngx_pool_cleanup_add(r->pool, - sizeof(ngx_http_limit_zone_cleanup_t)); + sizeof(ngx_http_limit_conn_cleanup_t)); if (cln == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } - cln->handler = ngx_http_limit_zone_cleanup; - lzcln = cln->data; + cln->handler = ngx_http_limit_conn_cleanup; + lccln = cln->data; - lzcln->shm_zone = limits[i].shm_zone; - lzcln->node = node; + lccln->shm_zone = limits[i].shm_zone; + lccln->node = node; } return NGX_DECLINED; @@ -259,11 +259,11 @@ ngx_http_limit_zone_handler(ngx_http_req static void -ngx_http_limit_zone_rbtree_insert_value(ngx_rbtree_node_t *temp, +ngx_http_limit_conn_rbtree_insert_value(ngx_rbtree_node_t *temp, ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel) { ngx_rbtree_node_t **p; - ngx_http_limit_zone_node_t *lzn, *lznt; + ngx_http_limit_conn_node_t *lcn, *lcnt; for ( ;; ) { @@ -277,10 +277,10 @@ ngx_http_limit_zone_rbtree_insert_value( } else { /* node->key == temp->key */ - lzn = (ngx_http_limit_zone_node_t *) &node->color; - lznt = (ngx_http_limit_zone_node_t *) &temp->color; + lcn = (ngx_http_limit_conn_node_t *) &node->color; + lcnt = (ngx_http_limit_conn_node_t *) &temp->color; - p = (ngx_memn2cmp(lzn->data, lznt->data, lzn->len, lznt->len) < 0) + p = (ngx_memn2cmp(lcn->data, lcnt->data, lcn->len, lcnt->len) < 0) ? &temp->left : &temp->right; } @@ -300,12 +300,12 @@ ngx_http_limit_zone_rbtree_insert_value( static ngx_rbtree_node_t * -ngx_http_limit_zone_lookup(ngx_rbtree_t *rbtree, ngx_http_variable_value_t *vv, +ngx_http_limit_conn_lookup(ngx_rbtree_t *rbtree, ngx_http_variable_value_t *vv, uint32_t hash) { ngx_int_t rc; ngx_rbtree_node_t *node, *sentinel; - ngx_http_limit_zone_node_t *lzn; + ngx_http_limit_conn_node_t *lcn; node = rbtree->root; sentinel = rbtree->sentinel; @@ -325,10 +325,10 @@ ngx_http_limit_zone_lookup(ngx_rbtree_t /* hash == node->key */ do { - lzn = (ngx_http_limit_zone_node_t *) &node->color; + lcn = (ngx_http_limit_conn_node_t *) &node->color; - rc = ngx_memn2cmp(vv->data, lzn->data, - (size_t) vv->len, (size_t) lzn->len); + rc = ngx_memn2cmp(vv->data, lcn->data, + (size_t) vv->len, (size_t) lcn->len); if (rc == 0) { return node; } @@ -345,28 +345,28 @@ ngx_http_limit_zone_lookup(ngx_rbtree_t static void -ngx_http_limit_zone_cleanup(void *data) +ngx_http_limit_conn_cleanup(void *data) { - ngx_http_limit_zone_cleanup_t *lzcln = data; + ngx_http_limit_conn_cleanup_t *lccln = data; ngx_slab_pool_t *shpool; ngx_rbtree_node_t *node; - ngx_http_limit_zone_ctx_t *ctx; - ngx_http_limit_zone_node_t *lz; + ngx_http_limit_conn_ctx_t *ctx; + ngx_http_limit_conn_node_t *lc; - ctx = lzcln->shm_zone->data; - shpool = (ngx_slab_pool_t *) lzcln->shm_zone->shm.addr; - node = lzcln->node; - lz = (ngx_http_limit_zone_node_t *) &node->color; + ctx = lccln->shm_zone->data; + shpool = (ngx_slab_pool_t *) lccln->shm_zone->shm.addr; + node = lccln->node; + lc = (ngx_http_limit_conn_node_t *) &node->color; ngx_shmtx_lock(&shpool->mutex); - ngx_log_debug2(NGX_LOG_DEBUG_HTTP, lzcln->shm_zone->shm.log, 0, - "limit zone cleanup: %08XD %d", node->key, lz->conn); + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, lccln->shm_zone->shm.log, 0, + "limit zone cleanup: %08XD %d", node->key, lc->conn); - lz->conn--; + lc->conn--; - if (lz->conn == 0) { + if (lc->conn == 0) { ngx_rbtree_delete(ctx->rbtree, node); ngx_slab_free_locked(shpool, node); } @@ -376,14 +376,14 @@ ngx_http_limit_zone_cleanup(void *data) static ngx_inline void -ngx_http_limit_zone_cleanup_all(ngx_pool_t *pool) +ngx_http_limit_conn_cleanup_all(ngx_pool_t *pool) { ngx_pool_cleanup_t *cln; cln = pool->cleanup; - while (cln && cln->handler == ngx_http_limit_zone_cleanup) { - ngx_http_limit_zone_cleanup(cln->data); + while (cln && cln->handler == ngx_http_limit_conn_cleanup) { + ngx_http_limit_conn_cleanup(cln->data); cln = cln->next; } @@ -392,14 +392,14 @@ ngx_http_limit_zone_cleanup_all(ngx_pool static ngx_int_t -ngx_http_limit_zone_init_zone(ngx_shm_zone_t *shm_zone, void *data) +ngx_http_limit_conn_init_zone(ngx_shm_zone_t *shm_zone, void *data) { - ngx_http_limit_zone_ctx_t *octx = data; + ngx_http_limit_conn_ctx_t *octx = data; size_t len; ngx_slab_pool_t *shpool; ngx_rbtree_node_t *sentinel; - ngx_http_limit_zone_ctx_t *ctx; + ngx_http_limit_conn_ctx_t *ctx; ctx = shm_zone->data; @@ -438,7 +438,7 @@ ngx_http_limit_zone_init_zone(ngx_shm_zo } ngx_rbtree_init(ctx->rbtree, sentinel, - ngx_http_limit_zone_rbtree_insert_value); + ngx_http_limit_conn_rbtree_insert_value); len = sizeof(" in limit_conn_zone \"\"") + shm_zone->shm.name.len; @@ -455,11 +455,11 @@ ngx_http_limit_zone_init_zone(ngx_shm_zo static void * -ngx_http_limit_zone_create_conf(ngx_conf_t *cf) +ngx_http_limit_conn_create_conf(ngx_conf_t *cf) { - ngx_http_limit_zone_conf_t *conf; + ngx_http_limit_conn_conf_t *conf; - conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_zone_conf_t)); + conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_conn_conf_t)); if (conf == NULL) { return NULL; } @@ -477,10 +477,10 @@ ngx_http_limit_zone_create_conf(ngx_conf static char * -ngx_http_limit_zone_merge_conf(ngx_conf_t *cf, void *parent, void *child) +ngx_http_limit_conn_merge_conf(ngx_conf_t *cf, void *parent, void *child) { - ngx_http_limit_zone_conf_t *prev = parent; - ngx_http_limit_zone_conf_t *conf = child; + ngx_http_limit_conn_conf_t *prev = parent; + ngx_http_limit_conn_conf_t *conf = child; if (conf->limits.elts == NULL) { *conf = *prev; @@ -500,7 +500,7 @@ ngx_http_limit_conn_zone(ngx_conf_t *cf, ngx_str_t *value, name, s; ngx_uint_t i; ngx_shm_zone_t *shm_zone; - ngx_http_limit_zone_ctx_t *ctx; + ngx_http_limit_conn_ctx_t *ctx; value = cf->args->elts; @@ -549,7 +549,7 @@ ngx_http_limit_conn_zone(ngx_conf_t *cf, value[i].len--; value[i].data++; - ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_zone_ctx_t)); + ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_conn_ctx_t)); if (ctx == NULL) { return NGX_CONF_ERROR; } @@ -584,7 +584,7 @@ ngx_http_limit_conn_zone(ngx_conf_t *cf, } shm_zone = ngx_shared_memory_add(cf, &name, size, - &ngx_http_limit_zone_module); + &ngx_http_limit_conn_module); if (shm_zone == NULL) { return NGX_CONF_ERROR; } @@ -598,7 +598,7 @@ ngx_http_limit_conn_zone(ngx_conf_t *cf, return NGX_CONF_ERROR; } - shm_zone->init = ngx_http_limit_zone_init_zone; + shm_zone->init = ngx_http_limit_conn_init_zone; shm_zone->data = ctx; return NGX_CONF_OK; @@ -611,7 +611,7 @@ ngx_http_limit_zone(ngx_conf_t *cf, ngx_ ssize_t n; ngx_str_t *value; ngx_shm_zone_t *shm_zone; - ngx_http_limit_zone_ctx_t *ctx; + ngx_http_limit_conn_ctx_t *ctx; ngx_conf_deprecated(cf, &ngx_conf_deprecated_limit_zone, NULL); @@ -626,7 +626,7 @@ ngx_http_limit_zone(ngx_conf_t *cf, ngx_ value[2].len--; value[2].data++; - ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_zone_ctx_t)); + ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_conn_ctx_t)); if (ctx == NULL) { return NGX_CONF_ERROR; } @@ -654,7 +654,7 @@ ngx_http_limit_zone(ngx_conf_t *cf, ngx_ shm_zone = ngx_shared_memory_add(cf, &value[1], n, - &ngx_http_limit_zone_module); + &ngx_http_limit_conn_module); if (shm_zone == NULL) { return NGX_CONF_ERROR; } @@ -668,7 +668,7 @@ ngx_http_limit_zone(ngx_conf_t *cf, ngx_ return NGX_CONF_ERROR; } - shm_zone->init = ngx_http_limit_zone_init_zone; + shm_zone->init = ngx_http_limit_conn_init_zone; shm_zone->data = ctx; return NGX_CONF_OK; @@ -679,8 +679,8 @@ static char * ngx_http_limit_conn(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_shm_zone_t *shm_zone; - ngx_http_limit_zone_conf_t *lzcf = conf; - ngx_http_limit_zone_limit_t *limit, *limits; + ngx_http_limit_conn_conf_t *lccf = conf; + ngx_http_limit_conn_limit_t *limit, *limits; ngx_str_t *value; ngx_int_t n; @@ -689,23 +689,23 @@ ngx_http_limit_conn(ngx_conf_t *cf, ngx_ value = cf->args->elts; shm_zone = ngx_shared_memory_add(cf, &value[1], 0, - &ngx_http_limit_zone_module); + &ngx_http_limit_conn_module); if (shm_zone == NULL) { return NGX_CONF_ERROR; } - limits = lzcf->limits.elts; + limits = lccf->limits.elts; if (limits == NULL) { - if (ngx_array_init(&lzcf->limits, cf->pool, 1, - sizeof(ngx_http_limit_zone_limit_t)) + if (ngx_array_init(&lccf->limits, cf->pool, 1, + sizeof(ngx_http_limit_conn_limit_t)) != NGX_OK) { return NGX_CONF_ERROR; } } - for (i = 0; i < lzcf->limits.nelts; i++) { + for (i = 0; i < lccf->limits.nelts; i++) { if (shm_zone == limits[i].shm_zone) { return "is duplicate"; } @@ -724,7 +724,7 @@ ngx_http_limit_conn(ngx_conf_t *cf, ngx_ return NGX_CONF_ERROR; } - limit = ngx_array_push(&lzcf->limits); + limit = ngx_array_push(&lccf->limits); limit->conn = n; limit->shm_zone = shm_zone; @@ -733,7 +733,7 @@ ngx_http_limit_conn(ngx_conf_t *cf, ngx_ static ngx_int_t -ngx_http_limit_zone_init(ngx_conf_t *cf) +ngx_http_limit_conn_init(ngx_conf_t *cf) { ngx_http_handler_pt *h; ngx_http_core_main_conf_t *cmcf; @@ -745,7 +745,7 @@ ngx_http_limit_zone_init(ngx_conf_t *cf) return NGX_ERROR; } - *h = ngx_http_limit_zone_handler; + *h = ngx_http_limit_conn_handler; return NGX_OK; } diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h @@ -480,7 +480,7 @@ struct ngx_http_request_s { * ngx_http_limit_zone_module and ngx_http_limit_req_module * we use the single bits in the request structure */ - unsigned limit_zone_set:1; + unsigned limit_conn_set:1; unsigned limit_req_set:1; #if 0