summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-03-26 15:24:19 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-03-26 15:24:19 +0000
commit1e5ef6b0f4c6c2b962168f92c7c853006d7a2132 (patch)
treecb981b212a8cb669e0a31f6775fc8f0aa8d5cc7c /src
parent517a8fc588f5b915c50477944d8317f1df7c4dab (diff)
downloadnginx-1e5ef6b0f4c6c2b962168f92c7c853006d7a2132.tar.gz
nginx-1e5ef6b0f4c6c2b962168f92c7c853006d7a2132.tar.bz2
fix alias with variables, but without captures,
the bug had been introduced in r2566 and r2573
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_core_module.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 2e455b1e4..ffdd0b044 100644
--- 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_request_t *r, ngx_str_t *path,
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_request_t *r, ngx_str_t *path,
*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);