Welcome! Log In Create A New Profile

Advanced

[nginx] Fixed config parsing of the last try_files parameter.

Sergey Kandaurov
May 28, 2014 12:20PM
details: http://hg.nginx.org/nginx/rev/790ba7484bb6
branches:
changeset: 5715:790ba7484bb6
user: Sergey Kandaurov <pluknet@nginx.com>
date: Wed May 28 20:18:05 2014 +0400
description:
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:

src/http/ngx_http_core_module.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r 80bd391c90d1 -r 790ba7484bb6 src/http/ngx_http_core_module.c
--- a/src/http/ngx_http_core_module.c Wed May 28 17:41:44 2014 +0400
+++ b/src/http/ngx_http_core_module.c Wed May 28 20:18:05 2014 +0400
@@ -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--;

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Fixed config parsing of the last try_files parameter.

Sergey Kandaurov 721 May 28, 2014 12:20PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 68
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready