aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_secure_link_module.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2013-01-28 14:42:07 +0000
committerRuslan Ermilov <ru@nginx.com>2013-01-28 14:42:07 +0000
commit4b46b7fc5b09c8afeb106db3c409cb7ba948fbfa (patch)
tree6f569820e77582fdd11c18fbb5a17401b340a86a /src/http/modules/ngx_http_secure_link_module.c
parent33e934ccc8fcf4f62fbbd08c1eb1b396cac5facb (diff)
downloadnginx-4b46b7fc5b09c8afeb106db3c409cb7ba948fbfa.tar.gz
nginx-4b46b7fc5b09c8afeb106db3c409cb7ba948fbfa.zip
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.
Diffstat (limited to 'src/http/modules/ngx_http_secure_link_module.c')
-rw-r--r--src/http/modules/ngx_http_secure_link_module.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/http/modules/ngx_http_secure_link_module.c b/src/http/modules/ngx_http_secure_link_module.c
index b69b5526f..907ba6ef5 100644
--- a/src/http/modules/ngx_http_secure_link_module.c
+++ b/src/http/modules/ngx_http_secure_link_module.c
@@ -111,7 +111,7 @@ ngx_http_secure_link_variable(ngx_http_request_t *r,
conf = ngx_http_get_module_loc_conf(r, ngx_http_secure_link_module);
- if (conf->secret.len) {
+ if (conf->secret.data) {
return ngx_http_secure_link_old_variable(r, conf, v, data);
}
@@ -318,7 +318,16 @@ ngx_http_secure_link_merge_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_http_secure_link_conf_t *prev = parent;
ngx_http_secure_link_conf_t *conf = child;
- ngx_conf_merge_str_value(conf->secret, prev->secret, "");
+ if (conf->secret.data) {
+ if (conf->variable || conf->md5) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"secure_link_secret\" cannot be mixed with "
+ "\"secure_link\" and \"secure_link_md5\"");
+ return NGX_CONF_ERROR;
+ }
+
+ return NGX_CONF_OK;
+ }
if (conf->variable == NULL) {
conf->variable = prev->variable;
@@ -328,6 +337,10 @@ ngx_http_secure_link_merge_conf(ngx_conf_t *cf, void *parent, void *child)
conf->md5 = prev->md5;
}
+ if (conf->variable == NULL && conf->md5 == NULL) {
+ conf->secret = prev->secret;
+ }
+
return NGX_CONF_OK;
}