# HG changeset patch # User Igor Sysoev # Date 1235934636 0 # Node ID e73f70b4ca5ce8a10e37cc55a25c02a829c6cef4 # Parent 042dcbaead66677146646ebc09fb32b30f9c1eb3 fix case when the first try is shorter then URI diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c --- 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) {