]> git.kaiwu.me - nginx.git/commitdiff
fix reserved mapped uri length if alias has captures
authorIgor Sysoev <igor@sysoev.ru>
Sat, 14 Mar 2009 19:20:34 +0000 (19:20 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sat, 14 Mar 2009 19:20:34 +0000 (19:20 +0000)
src/http/ngx_http_core_module.c

index 3af15de18693bdd92d9ef92748490abe0ece89d5..2d4feab75b0319e7e2df4440a496b63ede2ae15f 100644 (file)
@@ -1672,13 +1672,11 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
         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_request_t *r, ngx_str_t *path,
         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)
         {