Skip to content

Commit 92c6b8d

Browse files
committed
bugfix: init_worker_by_lua* did not honor http {} top-level configurations like lua_ssl_verify_depth and lua_ssl_trusted_certificate. thanks Vladimir Shaykovskiy for the report in openresty#709.
1 parent 3d61bf4 commit 92c6b8d

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/ngx_http_lua_initworkerby.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ngx_http_lua_init_worker(ngx_cycle_t *cycle)
3434
ngx_http_request_t *r = NULL;
3535
ngx_http_lua_ctx_t *ctx;
3636
ngx_http_conf_ctx_t *conf_ctx, http_ctx;
37-
ngx_http_lua_loc_conf_t *llcf, *top_llcf;
37+
ngx_http_lua_loc_conf_t *top_llcf;
3838
ngx_http_lua_main_conf_t *lmcf;
3939
ngx_http_core_loc_conf_t *clcf, *top_clcf;
4040

@@ -198,9 +198,17 @@ ngx_http_lua_init_worker(ngx_cycle_t *cycle)
198198
http_ctx.loc_conf[modules[i]->ctx_index] = cur;
199199

200200
if (module->merge_loc_conf) {
201-
prev = module->create_loc_conf(&conf);
202-
if (prev == NULL) {
203-
return NGX_ERROR;
201+
if (modules[i] == &ngx_http_lua_module) {
202+
prev = top_llcf;
203+
204+
} else if (modules[i] == &ngx_http_core_module) {
205+
prev = top_clcf;
206+
207+
} else {
208+
prev = module->create_loc_conf(&conf);
209+
if (prev == NULL) {
210+
return NGX_ERROR;
211+
}
204212
}
205213

206214
rv = module->merge_loc_conf(&conf, prev, cur);
@@ -254,10 +262,6 @@ ngx_http_lua_init_worker(ngx_cycle_t *cycle)
254262

255263
#endif
256264

257-
if (top_clcf->resolver) {
258-
clcf->resolver = top_clcf->resolver;
259-
}
260-
261265
ctx = ngx_http_lua_create_ctx(r);
262266
if (ctx == NULL) {
263267
goto failed;
@@ -267,11 +271,6 @@ ngx_http_lua_init_worker(ngx_cycle_t *cycle)
267271
ctx->cur_co_ctx = NULL;
268272
r->read_event_handler = ngx_http_block_reading;
269273

270-
llcf = ngx_http_get_module_loc_conf(r, ngx_http_lua_module);
271-
if (top_llcf->log_socket_errors != NGX_CONF_UNSET) {
272-
llcf->log_socket_errors = top_llcf->log_socket_errors;
273-
}
274-
275274
ngx_http_lua_set_req(lmcf->lua, r);
276275

277276
(void) lmcf->init_worker_handler(cycle->log, lmcf, lmcf->lua);

0 commit comments

Comments
 (0)