diff src/http/ngx_http_core_module.c @ 468:56baf312c1b5 NGINX_0_7_46

nginx 0.7.46 *) Bugfix: the previous release tarball was incorrect.
author Igor Sysoev <http://sysoev.ru>
date Mon, 30 Mar 2009 00:00:00 +0400
parents c8cfb6c462ef
children f2c6a7373274
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1695,7 +1695,15 @@ ngx_http_map_uri_to_path(ngx_http_reques
         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 @@ ngx_http_map_uri_to_path(ngx_http_reques
         *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);