Skip to content

Commit acd55f3

Browse files
committed
update merge location function config
1 parent 3b82186 commit acd55f3

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/ngx_link_func_module.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -623,18 +623,14 @@ ngx_http_link_func_subrequest_cmd(ngx_conf_t *cf, ngx_command_t *cmd, void *conf
623623
static char *
624624
ngx_http_link_func_init_method(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) {
625625
ngx_http_link_func_srv_conf_t *scf;
626-
ngx_http_link_func_loc_conf_t *lcf = conf;
627-
628626

629627
scf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_link_func_module);
630628

631629
if (scf && scf->_libname.len > 0) {
632-
ngx_http_link_func_loc_q_t *loc_q = ngx_pcalloc(cf->pool, sizeof(ngx_http_link_func_loc_q_t));
633-
loc_q->_loc_conf = lcf;
634-
ngx_queue_init(&loc_q->_queue);
635-
ngx_queue_insert_tail(scf->_link_func_locs_queue, &loc_q->_queue);
630+
return ngx_conf_set_str_slot(cf, cmd, conf);
636631
}
637-
return ngx_conf_set_str_slot(cf, cmd, conf);
632+
633+
return "No application linking in server block";
638634
} /* ngx_http_link_func_init_method */
639635

640636
static ngx_int_t
@@ -1156,13 +1152,24 @@ static char*
11561152
ngx_http_link_func_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) {
11571153
ngx_http_link_func_loc_conf_t *prev = parent;
11581154
ngx_http_link_func_loc_conf_t *conf = child;
1155+
ngx_http_link_func_srv_conf_t *scf;
1156+
1157+
scf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_link_func_module);
11591158

11601159
ngx_conf_merge_ptr_value(conf->ext_req_headers, prev->ext_req_headers, NULL);
11611160
#if (NGX_LINK_FUNC_SUBREQ) && (nginx_version > 1013009)
11621161
ngx_conf_merge_ptr_value(conf->subrequests, prev->subrequests, NULL);
11631162
#endif
11641163
ngx_conf_merge_str_value(conf->_method_name, prev->_method_name, "");
11651164

1165+
if (conf->_method_name.len != 0) {
1166+
if (scf && scf->_libname.len > 0) {
1167+
ngx_http_link_func_loc_q_t *loc_q = ngx_pcalloc(cf->pool, sizeof(ngx_http_link_func_loc_q_t));
1168+
loc_q->_loc_conf = conf;
1169+
ngx_queue_init(&loc_q->_queue);
1170+
ngx_queue_insert_tail(scf->_link_func_locs_queue, &loc_q->_queue);
1171+
}
1172+
}
11661173
// if (conf->_method_name.len == 0) {
11671174
// conf->_method_name = prev->_method_name;
11681175
// }

0 commit comments

Comments
 (0)