Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 2607:cb96a60c8f10
fix alias with variables, but without captures,
the bug had been introduced in r2566 and r2573
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 26 Mar 2009 15:24:19 +0000 |
parents | 3a8a53c0c42f |
children | 6c8a5165ed2a |
comparison
equal
deleted
inserted
replaced
2606:fd387fbb28c6 | 2607:cb96a60c8f10 |
---|---|
1693 } | 1693 } |
1694 | 1694 |
1695 last = ngx_copy(path->data, clcf->root.data, clcf->root.len); | 1695 last = ngx_copy(path->data, clcf->root.data, clcf->root.len); |
1696 | 1696 |
1697 } else { | 1697 } else { |
1698 reserved += alias ? 1 : r->uri.len + 1; | 1698 |
1699 #if (NGX_PCRE) | |
1700 ngx_uint_t captures; | |
1701 | |
1702 captures = alias && clcf->captures; | |
1703 reserved += captures ? 1 : r->uri.len - alias + 1; | |
1704 #else | |
1705 reserved += r->uri.len - alias + 1; | |
1706 #endif | |
1699 | 1707 |
1700 if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved, | 1708 if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved, |
1701 clcf->root_values->elts) | 1709 clcf->root_values->elts) |
1702 == NULL) | 1710 == NULL) |
1703 { | 1711 { |
1709 } | 1717 } |
1710 | 1718 |
1711 *root_length = path->len - reserved; | 1719 *root_length = path->len - reserved; |
1712 last = path->data + *root_length; | 1720 last = path->data + *root_length; |
1713 | 1721 |
1714 if (alias) { | 1722 #if (NGX_PCRE) |
1723 if (captures) { | |
1715 *last = '\0'; | 1724 *last = '\0'; |
1716 return last; | 1725 return last; |
1717 } | 1726 } |
1727 #endif | |
1718 } | 1728 } |
1719 | 1729 |
1720 last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1); | 1730 last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1); |
1721 | 1731 |
1722 return last; | 1732 return last; |