Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 6379:cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Feb 2016 18:30:21 +0300 |
parents | fcbac620ae83 |
children | cf3e75cfa951 |
comparison
equal
deleted
inserted
replaced
6378:0f203a2af17c | 6379:cf5e822cf470 |
---|---|
2966 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); | 2966 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
2967 if (ctx->loc_conf == NULL) { | 2967 if (ctx->loc_conf == NULL) { |
2968 return NGX_CONF_ERROR; | 2968 return NGX_CONF_ERROR; |
2969 } | 2969 } |
2970 | 2970 |
2971 for (i = 0; ngx_modules[i]; i++) { | 2971 for (i = 0; cf->cycle->modules[i]; i++) { |
2972 if (ngx_modules[i]->type != NGX_HTTP_MODULE) { | 2972 if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) { |
2973 continue; | 2973 continue; |
2974 } | 2974 } |
2975 | 2975 |
2976 module = ngx_modules[i]->ctx; | 2976 module = cf->cycle->modules[i]->ctx; |
2977 | 2977 |
2978 if (module->create_srv_conf) { | 2978 if (module->create_srv_conf) { |
2979 mconf = module->create_srv_conf(cf); | 2979 mconf = module->create_srv_conf(cf); |
2980 if (mconf == NULL) { | 2980 if (mconf == NULL) { |
2981 return NGX_CONF_ERROR; | 2981 return NGX_CONF_ERROR; |
2982 } | 2982 } |
2983 | 2983 |
2984 ctx->srv_conf[ngx_modules[i]->ctx_index] = mconf; | 2984 ctx->srv_conf[cf->cycle->modules[i]->ctx_index] = mconf; |
2985 } | 2985 } |
2986 | 2986 |
2987 if (module->create_loc_conf) { | 2987 if (module->create_loc_conf) { |
2988 mconf = module->create_loc_conf(cf); | 2988 mconf = module->create_loc_conf(cf); |
2989 if (mconf == NULL) { | 2989 if (mconf == NULL) { |
2990 return NGX_CONF_ERROR; | 2990 return NGX_CONF_ERROR; |
2991 } | 2991 } |
2992 | 2992 |
2993 ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf; | 2993 ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf; |
2994 } | 2994 } |
2995 } | 2995 } |
2996 | 2996 |
2997 | 2997 |
2998 /* the server configuration context */ | 2998 /* the server configuration context */ |
3084 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); | 3084 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
3085 if (ctx->loc_conf == NULL) { | 3085 if (ctx->loc_conf == NULL) { |
3086 return NGX_CONF_ERROR; | 3086 return NGX_CONF_ERROR; |
3087 } | 3087 } |
3088 | 3088 |
3089 for (i = 0; ngx_modules[i]; i++) { | 3089 for (i = 0; cf->cycle->modules[i]; i++) { |
3090 if (ngx_modules[i]->type != NGX_HTTP_MODULE) { | 3090 if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) { |
3091 continue; | 3091 continue; |
3092 } | 3092 } |
3093 | 3093 |
3094 module = ngx_modules[i]->ctx; | 3094 module = cf->cycle->modules[i]->ctx; |
3095 | 3095 |
3096 if (module->create_loc_conf) { | 3096 if (module->create_loc_conf) { |
3097 ctx->loc_conf[ngx_modules[i]->ctx_index] = | 3097 ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = |
3098 module->create_loc_conf(cf); | 3098 module->create_loc_conf(cf); |
3099 if (ctx->loc_conf[ngx_modules[i]->ctx_index] == NULL) { | 3099 if (ctx->loc_conf[cf->cycle->modules[i]->ctx_index] == NULL) { |
3100 return NGX_CONF_ERROR; | 3100 return NGX_CONF_ERROR; |
3101 } | 3101 } |
3102 } | 3102 } |
3103 } | 3103 } |
3104 | 3104 |
4605 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); | 4605 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
4606 if (ctx->loc_conf == NULL) { | 4606 if (ctx->loc_conf == NULL) { |
4607 return NGX_CONF_ERROR; | 4607 return NGX_CONF_ERROR; |
4608 } | 4608 } |
4609 | 4609 |
4610 for (i = 0; ngx_modules[i]; i++) { | 4610 for (i = 0; cf->cycle->modules[i]; i++) { |
4611 if (ngx_modules[i]->type != NGX_HTTP_MODULE) { | 4611 if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) { |
4612 continue; | 4612 continue; |
4613 } | 4613 } |
4614 | 4614 |
4615 module = ngx_modules[i]->ctx; | 4615 module = cf->cycle->modules[i]->ctx; |
4616 | 4616 |
4617 if (module->create_loc_conf) { | 4617 if (module->create_loc_conf) { |
4618 | 4618 |
4619 mconf = module->create_loc_conf(cf); | 4619 mconf = module->create_loc_conf(cf); |
4620 if (mconf == NULL) { | 4620 if (mconf == NULL) { |
4621 return NGX_CONF_ERROR; | 4621 return NGX_CONF_ERROR; |
4622 } | 4622 } |
4623 | 4623 |
4624 ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf; | 4624 ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf; |
4625 } | 4625 } |
4626 } | 4626 } |
4627 | 4627 |
4628 | 4628 |
4629 clcf = ctx->loc_conf[ngx_http_core_module.ctx_index]; | 4629 clcf = ctx->loc_conf[ngx_http_core_module.ctx_index]; |