comparison src/http/ngx_http_core_module.c @ 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 c985d90a8d1f
children e491b26fa5a1
comparison
equal deleted inserted replaced
5714:80bd391c90d1 5715:790ba7484bb6
4787 for (i = 0; i < cf->args->nelts - 1; i++) { 4787 for (i = 0; i < cf->args->nelts - 1; i++) {
4788 4788
4789 tf[i].name = value[i + 1]; 4789 tf[i].name = value[i + 1];
4790 4790
4791 if (tf[i].name.len > 0 4791 if (tf[i].name.len > 0
4792 && tf[i].name.data[tf[i].name.len - 1] == '/') 4792 && tf[i].name.data[tf[i].name.len - 1] == '/'
4793 && i + 2 < cf->args->nelts)
4793 { 4794 {
4794 tf[i].test_dir = 1; 4795 tf[i].test_dir = 1;
4795 tf[i].name.len--; 4796 tf[i].name.len--;
4796 tf[i].name.data[tf[i].name.len] = '\0'; 4797 tf[i].name.data[tf[i].name.len] = '\0';
4797 } 4798 }