comparison src/http/ngx_http_core_module.c @ 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
comparison
equal deleted inserted replaced
2564:47839f59ce2a 2565:456e453eb84a
1670 "\"alias\" could not be used in location \"%V\" " 1670 "\"alias\" could not be used in location \"%V\" "
1671 "where URI was rewritten", &clcf->name); 1671 "where URI was rewritten", &clcf->name);
1672 return NULL; 1672 return NULL;
1673 } 1673 }
1674 1674
1675 reserved += r->uri.len - alias + 1;
1676
1677 if (clcf->root_lengths == NULL) { 1675 if (clcf->root_lengths == NULL) {
1678 1676
1679 *root_length = clcf->root.len; 1677 *root_length = clcf->root.len;
1680 1678
1681 path->len = clcf->root.len + reserved; 1679 path->len = clcf->root.len + reserved + r->uri.len - alias + 1;
1682 1680
1683 path->data = ngx_pnalloc(r->pool, path->len); 1681 path->data = ngx_pnalloc(r->pool, path->len);
1684 if (path->data == NULL) { 1682 if (path->data == NULL) {
1685 return NULL; 1683 return NULL;
1686 } 1684 }
1687 1685
1688 last = ngx_copy(path->data, clcf->root.data, clcf->root.len); 1686 last = ngx_copy(path->data, clcf->root.data, clcf->root.len);
1689 1687
1690 } else { 1688 } else {
1691 if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved, 1689 if (ngx_http_script_run(r, path, clcf->root_lengths->elts, ++reserved,
1692 clcf->root_values->elts) 1690 clcf->root_values->elts)
1693 == NULL) 1691 == NULL)
1694 { 1692 {
1695 return NULL; 1693 return NULL;
1696 } 1694 }