changeset 2541:e73f70b4ca5c

fix case when the first try is shorter then URI
author Igor Sysoev <igor@sysoev.ru>
date Sun, 01 Mar 2009 19:10:36 +0000
parents 042dcbaead66
children 925b5df2e0c2
files src/http/ngx_http_core_module.c
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1086,12 +1086,8 @@ ngx_http_core_try_files_phase(ngx_http_r
             len = tf->name.len;
         }
 
-        reserve = len - r->uri.len;
-
         /* 16 bytes are preallocation */
-        reserve = reserve < 16 ? 16 : reserve + 16;
-
-        reserve += alias;
+        reserve = ngx_abs((ssize_t) (len - r->uri.len)) + alias + 16;
 
         if (reserve > allocated) {