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
110 | 110 | |
111 | 111 | conf = ngx_http_get_module_loc_conf(r, ngx_http_secure_link_module); |
112 | 112 | |
113 | if (conf->secret.len) { | |
113 | if (conf->secret.data) { | |
114 | 114 | return ngx_http_secure_link_old_variable(r, conf, v, data); |
115 | 115 | } |
116 | 116 | |
317 | 317 | ngx_http_secure_link_conf_t *prev = parent; |
318 | 318 | ngx_http_secure_link_conf_t *conf = child; |
319 | 319 | |
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 | } | |
321 | 330 | |
322 | 331 | if (conf->variable == NULL) { |
323 | 332 | conf->variable = prev->variable; |
325 | 334 | |
326 | 335 | if (conf->md5 == NULL) { |
327 | 336 | conf->md5 = prev->md5; |
337 | } | |
338 | ||
339 | if (conf->variable == NULL && conf->md5 == NULL) { | |
340 | conf->secret = prev->secret; | |
328 | 341 | } |
329 | 342 | |
330 | 343 | return NGX_CONF_OK; |