Klaus Demo nginx / 6131218
Merge of r5018: secure link: fixed configuration inheritance. The "secure_link_secret" directive was always inherited from the outer configuration level even when "secure_link" and "secure_link_md5" were specified on the inner level. Maxim Dounin 9 years ago
1 changed file(s) with 15 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
110110
111111 conf = ngx_http_get_module_loc_conf(r, ngx_http_secure_link_module);
112112
113 if (conf->secret.len) {
113 if (conf->secret.data) {
114114 return ngx_http_secure_link_old_variable(r, conf, v, data);
115115 }
116116
317317 ngx_http_secure_link_conf_t *prev = parent;
318318 ngx_http_secure_link_conf_t *conf = child;
319319
320 ngx_conf_merge_str_value(conf->secret, prev->secret, "");
320 if (conf->secret.data) {
321 if (conf->variable || conf->md5) {
322 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
323 "\"secure_link_secret\" cannot be mixed with "
324 "\"secure_link\" and \"secure_link_md5\"");
325 return NGX_CONF_ERROR;
326 }
327
328 return NGX_CONF_OK;
329 }
321330
322331 if (conf->variable == NULL) {
323332 conf->variable = prev->variable;
325334
326335 if (conf->md5 == NULL) {
327336 conf->md5 = prev->md5;
337 }
338
339 if (conf->variable == NULL && conf->md5 == NULL) {
340 conf->secret = prev->secret;
328341 }
329342
330343 return NGX_CONF_OK;