]> git.kaiwu.me - nginx.git/commitdiff
fix case when the first try is shorter then URI
authorIgor Sysoev <igor@sysoev.ru>
Sun, 1 Mar 2009 19:10:36 +0000 (19:10 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sun, 1 Mar 2009 19:10:36 +0000 (19:10 +0000)
src/http/ngx_http_core_module.c

index 6a5daddb3def55487cc2e7c6fab943c47de55ed9..88672f0881a134f0cb1cbab2b75f0b3f08deb26e 100644 (file)
@@ -1086,12 +1086,8 @@ ngx_http_core_try_files_phase(ngx_http_request_t *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) {