# HG changeset patch # User Igor Sysoev # Date 1238081059 0 # Node ID cb96a60c8f10068f95fb117cb602da61ce3417b5 # Parent fd387fbb28c61c70c74d305beb53603f935c6c51 fix alias with variables, but without captures, the bug had been introduced in r2566 and r2573 diff -r fd387fbb28c6 -r cb96a60c8f10 src/http/ngx_http_core_module.c --- a/src/http/ngx_http_core_module.c Thu Mar 26 14:00:28 2009 +0000 +++ b/src/http/ngx_http_core_module.c Thu Mar 26 15:24:19 2009 +0000 @@ -1695,7 +1695,15 @@ last = ngx_copy(path->data, clcf->root.data, clcf->root.len); } else { - reserved += alias ? 1 : r->uri.len + 1; + +#if (NGX_PCRE) + ngx_uint_t captures; + + captures = alias && clcf->captures; + reserved += captures ? 1 : r->uri.len - alias + 1; +#else + reserved += r->uri.len - alias + 1; +#endif if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved, clcf->root_values->elts) @@ -1711,10 +1719,12 @@ *root_length = path->len - reserved; last = path->data + *root_length; - if (alias) { +#if (NGX_PCRE) + if (captures) { *last = '\0'; return last; } +#endif } last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1);