changeset 2565:456e453eb84a

fix reserved mapped uri length if alias has captures
author Igor Sysoev <igor@sysoev.ru>
date Sat, 14 Mar 2009 19:20:34 +0000
parents 47839f59ce2a
children 5e7d590cd704
files src/http/ngx_http_core_module.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1672,13 +1672,11 @@ ngx_http_map_uri_to_path(ngx_http_reques
         return NULL;
     }
 
-    reserved += r->uri.len - alias + 1;
-
     if (clcf->root_lengths == NULL) {
 
         *root_length = clcf->root.len;
 
-        path->len = clcf->root.len + reserved;
+        path->len = clcf->root.len + reserved + r->uri.len - alias + 1;
 
         path->data = ngx_pnalloc(r->pool, path->len);
         if (path->data == NULL) {
@@ -1688,7 +1686,7 @@ ngx_http_map_uri_to_path(ngx_http_reques
         last = ngx_copy(path->data, clcf->root.data, clcf->root.len);
 
     } else {
-        if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved,
+        if (ngx_http_script_run(r, path, clcf->root_lengths->elts, ++reserved,
                                 clcf->root_values->elts)
             == NULL)
         {