static ngx_int_t
ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last)
{char *rv;void *conf, **confp;ngx_uint_t i, found;ngx_str_t *name;ngx_command_t *cmd;name = cf->args->elts;found = 0;
name->data=index
for (i = 0; cf->cycle->modules[i]; i++) {cmd = cf->cycle->modules[i]->commands;if (cmd == NULL) {continue;}for ( /* void */ ; cmd->name.len; cmd++) {if (name->len != cmd->name.len) {continue;}if (ngx_strcmp(name->data, cmd->name.data) != 0) {continue;}found = 1;
查找 此次 要处理的指令 index
直到
i=16
modules[16]->name=ngx_http_index_module
else if (cf->ctx) {confp = *(void **) ((char *) cf->ctx + cmd->conf);if (confp) {conf = confp[cf->cycle->modules[i]->ctx_index];}}
获取指向当前指令所在配置结构的指针
此时
cmd->conf=16
ctx_index=7
rv = cmd->set(cf, cmd, conf);
根据参数设置当前指令对应的配置
此时是
ngx_http_index_module 模块的 index 指令 的 set 函数指针
指向的是
ngx_http_index_set_index
ngx_http_index_set_index-CSDN博客
if (rv == NGX_CONF_OK) {return NGX_OK;}
返回 NGX_OK