found = 0;
- for (i = 0; ngx_modules[i]; i++) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
- cmd = ngx_modules[i]->commands;
+ cmd = cf->cycle->modules[i]->commands;
if (cmd == NULL) {
continue;
}
found = 1;
- if (ngx_modules[i]->type != NGX_CONF_MODULE
- && ngx_modules[i]->type != cf->module_type)
+ if (cf->cycle->modules[i]->type != NGX_CONF_MODULE
+ && cf->cycle->modules[i]->type != cf->module_type)
{
continue;
}
conf = NULL;
if (cmd->type & NGX_DIRECT_CONF) {
- conf = ((void **) cf->ctx)[ngx_modules[i]->index];
+ conf = ((void **) cf->ctx)[cf->cycle->modules[i]->index];
} else if (cmd->type & NGX_MAIN_CONF) {
- conf = &(((void **) cf->ctx)[ngx_modules[i]->index]);
+ conf = &(((void **) cf->ctx)[cf->cycle->modules[i]->index]);
} else if (cf->ctx) {
confp = *(void **) ((char *) cf->ctx + cmd->conf);
if (confp) {
- conf = confp[ngx_modules[i]->ctx_index];
+ conf = confp[cf->cycle->modules[i]->ctx_index];
}
}
ngx_strlow(cycle->hostname.data, (u_char *) hostname, cycle->hostname.len);
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_CORE_MODULE) {
+ cycle->modules = ngx_modules;
+
+
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->type != NGX_CORE_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cycle->modules[i]->ctx;
if (module->create_conf) {
rv = module->create_conf(cycle);
ngx_destroy_pool(pool);
return NULL;
}
- cycle->conf_ctx[ngx_modules[i]->index] = rv;
+ cycle->conf_ctx[cycle->modules[i]->index] = rv;
}
}
cycle->conf_file.data);
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_CORE_MODULE) {
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->type != NGX_CORE_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cycle->modules[i]->ctx;
if (module->init_conf) {
- if (module->init_conf(cycle, cycle->conf_ctx[ngx_modules[i]->index])
+ if (module->init_conf(cycle,
+ cycle->conf_ctx[cycle->modules[i]->index])
== NGX_CONF_ERROR)
{
environ = senv;
ngx_connection_t *free_connections;
ngx_uint_t free_connection_n;
+ ngx_module_t **modules;
+
ngx_queue_t reusable_connections_queue;
ngx_array_t listening;
{
ngx_uint_t i;
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->init_module) {
- if (ngx_modules[i]->init_module(cycle) != NGX_OK) {
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->init_module) {
+ if (cycle->modules[i]->init_module(cycle) != NGX_OK) {
return NGX_ERROR;
}
}
/* count appropriate modules, set up their indices */
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != type) {
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->type != type) {
continue;
}
- ngx_modules[i]->ctx_index = max++;
+ cycle->modules[i]->ctx_index = max++;
}
return max;
return NGX_ERROR;
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
+ for (m = 0; cycle->modules[m]; m++) {
+ if (cycle->modules[m]->type != NGX_EVENT_MODULE) {
continue;
}
- if (ngx_modules[m]->ctx_index != ecf->use) {
+ if (cycle->modules[m]->ctx_index != ecf->use) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cycle->modules[m]->ctx;
if (module->actions.init(cycle, ngx_timer_resolution) != NGX_OK) {
/* fatal */
*(void **) conf = ctx;
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_EVENT_MODULE) {
continue;
}
- m = ngx_modules[i]->ctx;
+ m = cf->cycle->modules[i]->ctx;
if (m->create_conf) {
- (*ctx)[ngx_modules[i]->ctx_index] = m->create_conf(cf->cycle);
- if ((*ctx)[ngx_modules[i]->ctx_index] == NULL) {
+ (*ctx)[cf->cycle->modules[i]->ctx_index] =
+ m->create_conf(cf->cycle);
+ if ((*ctx)[cf->cycle->modules[i]->ctx_index] == NULL) {
return NGX_CONF_ERROR;
}
}
return rv;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_EVENT_MODULE) {
continue;
}
- m = ngx_modules[i]->ctx;
+ m = cf->cycle->modules[i]->ctx;
if (m->init_conf) {
- rv = m->init_conf(cf->cycle, (*ctx)[ngx_modules[i]->ctx_index]);
+ rv = m->init_conf(cf->cycle,
+ (*ctx)[cf->cycle->modules[i]->ctx_index]);
if (rv != NGX_CONF_OK) {
return rv;
}
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_EVENT_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->name->len == value[1].len) {
if (ngx_strcmp(module->name->data, value[1].data) == 0) {
- ecf->use = ngx_modules[m]->ctx_index;
+ ecf->use = cf->cycle->modules[m]->ctx_index;
ecf->name = module->name->data;
if (ngx_process == NGX_PROCESS_SINGLE
#endif
if (module == NULL) {
- for (i = 0; ngx_modules[i]; i++) {
+ for (i = 0; cycle->modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_EVENT_MODULE) {
+ if (cycle->modules[i]->type != NGX_EVENT_MODULE) {
continue;
}
- event_module = ngx_modules[i]->ctx;
+ event_module = cycle->modules[i]->ctx;
if (ngx_strcmp(event_module->name->data, event_core_name.data) == 0)
{
continue;
}
- module = ngx_modules[i];
+ module = cycle->modules[i];
break;
}
}
return NGX_CONF_ERROR;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cf->cycle->modules[i]->ctx;
if (module->create_loc_conf) {
return NGX_CONF_ERROR;
}
- ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
+ ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
}
}
* of the all http modules
*/
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
if (module->create_main_conf) {
ctx->main_conf[mi] = module->create_main_conf(cf);
pcf = *cf;
cf->ctx = ctx;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->preconfiguration) {
if (module->preconfiguration(cf) != NGX_OK) {
cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
cscfp = cmcf->servers.elts;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
/* init http{} main_conf's */
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->postconfiguration) {
if (module->postconfiguration(cf) != NGX_OK) {
return NGX_CONF_ERROR;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cf->cycle->modules[i]->ctx;
if (module->create_srv_conf) {
mconf = module->create_srv_conf(cf);
return NGX_CONF_ERROR;
}
- ctx->srv_conf[ngx_modules[i]->ctx_index] = mconf;
+ ctx->srv_conf[cf->cycle->modules[i]->ctx_index] = mconf;
}
if (module->create_loc_conf) {
return NGX_CONF_ERROR;
}
- ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
+ ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
}
}
return NGX_CONF_ERROR;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cf->cycle->modules[i]->ctx;
if (module->create_loc_conf) {
- ctx->loc_conf[ngx_modules[i]->ctx_index] =
+ ctx->loc_conf[cf->cycle->modules[i]->ctx_index] =
module->create_loc_conf(cf);
- if (ctx->loc_conf[ngx_modules[i]->ctx_index] == NULL) {
+ if (ctx->loc_conf[cf->cycle->modules[i]->ctx_index] == NULL) {
return NGX_CONF_ERROR;
}
}
return NGX_CONF_ERROR;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
+ for (i = 0; cf->cycle->modules[i]; i++) {
+ if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[i]->ctx;
+ module = cf->cycle->modules[i]->ctx;
if (module->create_loc_conf) {
return NGX_CONF_ERROR;
}
- ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
+ ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
}
}
return NGX_CONF_ERROR;
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->create_srv_conf) {
mconf = module->create_srv_conf(cf);
return NGX_CONF_ERROR;
}
- ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
+ ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
}
if (module->create_loc_conf) {
return NGX_CONF_ERROR;
}
- ctx->loc_conf[ngx_modules[m]->ctx_index] = mconf;
+ ctx->loc_conf[cf->cycle->modules[m]->ctx_index] = mconf;
}
}
* create the main_conf's and the null srv_conf's of the all mail modules
*/
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
if (module->create_main_conf) {
ctx->main_conf[mi] = module->create_main_conf(cf);
cmcf = ctx->main_conf[ngx_mail_core_module.ctx_index];
cscfp = cmcf->servers.elts;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
/* init mail{} main_conf's */
return NGX_CONF_ERROR;
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->create_srv_conf) {
mconf = module->create_srv_conf(cf);
return NGX_CONF_ERROR;
}
- ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
+ ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
}
}
#endif
if (cscf->protocol == NULL) {
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->protocol == NULL) {
continue;
value = cf->args->elts;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->protocol
&& ngx_strcmp(module->protocol->name.data, value[1].data) == 0)
exit(2);
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->init_process) {
- if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) {
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->init_process) {
+ if (cycle->modules[i]->init_process(cycle) == NGX_ERROR) {
/* fatal */
exit(2);
}
if (ngx_terminate || ngx_quit) {
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->exit_process) {
- ngx_modules[i]->exit_process(cycle);
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->exit_process) {
+ cycle->modules[i]->exit_process(cycle);
}
}
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exit");
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->exit_master) {
- ngx_modules[i]->exit_master(cycle);
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->exit_master) {
+ cycle->modules[i]->exit_master(cycle);
}
}
ls[i].previous = NULL;
}
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->init_process) {
- if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) {
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->init_process) {
+ if (cycle->modules[i]->init_process(cycle) == NGX_ERROR) {
/* fatal */
exit(2);
}
ngx_uint_t i;
ngx_connection_t *c;
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->exit_process) {
- ngx_modules[i]->exit_process(cycle);
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->exit_process) {
+ cycle->modules[i]->exit_process(cycle);
}
}
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exit");
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->exit_master) {
- ngx_modules[i]->exit_master(cycle);
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->exit_master) {
+ cycle->modules[i]->exit_master(cycle);
}
}
cycle = (ngx_cycle_t *) ngx_cycle;
- for (n = 0; ngx_modules[n]; n++) {
- if (ngx_modules[n]->init_process) {
- if (ngx_modules[n]->init_process(cycle) == NGX_ERROR) {
+ for (n = 0; cycle->modules[n]; n++) {
+ if (cycle->modules[n]->init_process) {
+ if (cycle->modules[n]->init_process(cycle) == NGX_ERROR) {
/* fatal */
exit(2);
}
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exit");
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->exit_process) {
- ngx_modules[i]->exit_process(cycle);
+ for (i = 0; cycle->modules[i]; i++) {
+ if (cycle->modules[i]->exit_process) {
+ cycle->modules[i]->exit_process(cycle);
}
}
* create the main_conf's and the null srv_conf's of the all stream modules
*/
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
if (module->create_main_conf) {
ctx->main_conf[mi] = module->create_main_conf(cf);
cmcf = ctx->main_conf[ngx_stream_core_module.ctx_index];
cscfp = cmcf->servers.elts;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
- mi = ngx_modules[m]->ctx_index;
+ module = cf->cycle->modules[m]->ctx;
+ mi = cf->cycle->modules[m]->ctx_index;
/* init stream{} main_conf's */
}
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->postconfiguration) {
if (module->postconfiguration(cf) != NGX_OK) {
return NGX_CONF_ERROR;
}
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->create_srv_conf) {
mconf = module->create_srv_conf(cf);
return NGX_CONF_ERROR;
}
- ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
+ ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
}
}
uscf->srv_conf = ctx->srv_conf;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_STREAM_MODULE) {
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
continue;
}
- module = ngx_modules[m]->ctx;
+ module = cf->cycle->modules[m]->ctx;
if (module->create_srv_conf) {
mconf = module->create_srv_conf(cf);
return NGX_CONF_ERROR;
}
- ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
+ ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
}
}