diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2014-05-28 20:18:05 +0400 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2014-05-28 20:18:05 +0400 |
commit | 0750df4f16d6e39dfdf36ce69f363499aceff7d5 (patch) | |
tree | 9a40daf9a0e3af59d5ee47f2a03b508cf512de66 /src | |
parent | e9a70114a2b91a5d60f6205739d4207575e8495c (diff) | |
download | nginx-0750df4f16d6e39dfdf36ce69f363499aceff7d5.tar.gz nginx-0750df4f16d6e39dfdf36ce69f363499aceff7d5.zip |
Fixed config parsing of the last try_files parameter.
Do not taste the last parameter against directory, as otherwise it would
result in the trailing slash being cut from the parameter value.
Notably, this prevents an internal redirect to an empty URI
if the parameter is set to the literal slash:
location / { try_files $uri /; }
Diffstat (limited to 'src')
-rw-r--r-- | src/http/ngx_http_core_module.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 741a80d93..fb02dd465 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -4789,7 +4789,8 @@ ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) tf[i].name = value[i + 1]; if (tf[i].name.len > 0 - && tf[i].name.data[tf[i].name.len - 1] == '/') + && tf[i].name.data[tf[i].name.len - 1] == '/' + && i + 2 < cf->args->nelts) { tf[i].test_dir = 1; tf[i].name.len--; |