Skip to content

Commit a8d60d4

Browse files
committed
Revert "synchronized with lua-nginx-module #09484e8 (do not mutate another module's main_conf)."
This reverts commit 40b124e. Also reverted in openresty/lua-nginx-module@c2390ab. See details at: openresty/lua-nginx-module#1627
1 parent 0400d86 commit a8d60d4

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

src/subsys/ngx_subsys_lua_initworkerby.c.tt2

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ ngx_[% subsys %]_lua_init_worker(ngx_cycle_t *cycle)
108108

109109
conf_ctx = (ngx_[% subsys %]_conf_ctx_t *)
110110
cycle->conf_ctx[ngx_[% subsys %]_module.index];
111+
[% subsys %]_ctx.main_conf = conf_ctx->main_conf;
111112

112113
[% IF http_subsys %]
113114
top_clcf = conf_ctx->loc_conf[ngx_http_core_module.ctx_index];
@@ -231,12 +232,6 @@ ngx_[% subsys %]_lua_init_worker(ngx_cycle_t *cycle)
231232
return NGX_ERROR;
232233
}
233234

234-
[% subsys %]_ctx.main_conf = ngx_pcalloc(conf.pool,
235-
sizeof(void *) * ngx_[% subsys %]_max_module);
236-
if ([% subsys %]_ctx.main_conf == NULL) {
237-
return NGX_ERROR;
238-
}
239-
240235
#if defined(nginx_version) && nginx_version >= 1009011
241236
modules = cycle->modules;
242237
#else
@@ -250,21 +245,6 @@ ngx_[% subsys %]_lua_init_worker(ngx_cycle_t *cycle)
250245

251246
module = modules[i]->ctx;
252247

253-
if (module->create_main_conf) {
254-
cur = module->create_main_conf(&conf);
255-
if (cur == NULL) {
256-
return NGX_ERROR;
257-
}
258-
259-
if (ngx_modules[i]->index == ngx_[% subsys %]_lua_module.index) {
260-
ngx_memcpy(cur,
261-
conf_ctx->main_conf[ngx_[% subsys %]_lua_module.ctx_index],
262-
sizeof(ngx_[% subsys %]_lua_main_conf_t));
263-
}
264-
265-
[% subsys %]_ctx.main_conf[modules[i]->ctx_index] = cur;
266-
}
267-
268248
if (module->create_srv_conf) {
269249
cur = module->create_srv_conf(&conf);
270250
if (cur == NULL) {

0 commit comments

Comments
 (0)