Renamed nxt_http_static_ctx_t field 'index' to 'share_idx'.
Having a configurable index filename will require adding an index field to this structure. The most natural name for that field is 'index', so the current index field should be renamed to allow for that. A sensible name is 'share_idx', since it's the index of the shares array in 'nxt_http_static_conf_t'. Instead of 'share_index' I opted for the shorter 'share_idx'. Also, when 'index' allows an array of filenames in a following commit, another similar variable 'index_idx' should be created, and having a different prefix and suffix seems more readable than for example 'index_index'.
This commit is contained in:
parent
fa42d858a2
commit
5302faace2
1 changed files with 7 additions and 7 deletions
|
@ -33,7 +33,7 @@ typedef struct {
|
|||
#if (NXT_HAVE_OPENAT2)
|
||||
nxt_str_t chroot;
|
||||
#endif
|
||||
uint32_t index;
|
||||
uint32_t share_idx;
|
||||
uint8_t need_body; /* 1 bit */
|
||||
} nxt_http_static_ctx_t;
|
||||
|
||||
|
@ -218,7 +218,7 @@ nxt_http_static_iterate(nxt_task_t *task, nxt_http_request_t *r,
|
|||
|
||||
conf = ctx->action->u.conf;
|
||||
|
||||
share = &conf->shares[ctx->index];
|
||||
share = &conf->shares[ctx->share_idx];
|
||||
|
||||
#if (NXT_DEBUG)
|
||||
nxt_str_t shr;
|
||||
|
@ -245,7 +245,7 @@ nxt_http_static_iterate(nxt_task_t *task, nxt_http_request_t *r,
|
|||
nxt_var_raw(share->var, &ctx->share);
|
||||
|
||||
#if (NXT_HAVE_OPENAT2)
|
||||
if (conf->chroot != NULL && ctx->index == 0) {
|
||||
if (conf->chroot != NULL && ctx->share_idx == 0) {
|
||||
nxt_var_raw(conf->chroot, &ctx->chroot);
|
||||
}
|
||||
#endif
|
||||
|
@ -262,7 +262,7 @@ nxt_http_static_iterate(nxt_task_t *task, nxt_http_request_t *r,
|
|||
nxt_var_query(task, r->var_query, share->var, &ctx->share);
|
||||
|
||||
#if (NXT_HAVE_OPENAT2)
|
||||
if (conf->chroot != NULL && ctx->index == 0) {
|
||||
if (conf->chroot != NULL && ctx->share_idx == 0) {
|
||||
nxt_var_query(task, r->var_query, conf->chroot, &ctx->chroot);
|
||||
}
|
||||
#endif
|
||||
|
@ -357,7 +357,7 @@ nxt_http_static_send_ready(nxt_task_t *task, void *obj, void *data)
|
|||
nxt_uint_t resolve;
|
||||
nxt_http_static_share_t *share;
|
||||
|
||||
share = &conf->shares[ctx->index];
|
||||
share = &conf->shares[ctx->share_idx];
|
||||
|
||||
resolve = conf->resolve;
|
||||
chr = &ctx->chroot;
|
||||
|
@ -659,9 +659,9 @@ nxt_http_static_next(nxt_task_t *task, nxt_http_request_t *r,
|
|||
action = ctx->action;
|
||||
conf = action->u.conf;
|
||||
|
||||
ctx->index++;
|
||||
ctx->share_idx++;
|
||||
|
||||
if (ctx->index < conf->nshares) {
|
||||
if (ctx->share_idx < conf->nshares) {
|
||||
nxt_http_static_iterate(task, r, ctx);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue