changeset 5715:790ba7484bb6

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 /; }
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 28 May 2014 20:18:05 +0400
parents 80bd391c90d1
children 34d460c5d186
files src/http/ngx_http_core_module.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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, 
         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--;