comparison src/http/ngx_http_script.c @ 3344:1aed55182ea2

fix captures in "rewrite", the bug had been introduced in r3326
author Igor Sysoev <igor@sysoev.ru>
date Mon, 16 Nov 2009 19:10:45 +0000
parents 42c16d8bddbe
children dd1570b6f237
comparison
equal deleted inserted replaced
3343:3051e512e301 3344:1aed55182ea2
908 908
909 if (code->lengths == NULL) { 909 if (code->lengths == NULL) {
910 e->buf.len = code->size; 910 e->buf.len = code->size;
911 911
912 if (code->uri) { 912 if (code->uri) {
913 if (rc && (r->quoted_uri || r->plus_in_uri)) { 913 if (r->ncaptures && (r->quoted_uri || r->plus_in_uri)) {
914 e->buf.len += 2 * ngx_escape_uri(NULL, r->uri.data, r->uri.len, 914 e->buf.len += 2 * ngx_escape_uri(NULL, r->uri.data, r->uri.len,
915 NGX_ESCAPE_ARGS); 915 NGX_ESCAPE_ARGS);
916 } 916 }
917 } 917 }
918 918
919 for (n = 1; n < (ngx_uint_t) rc; n++) { 919 for (n = 2; n < r->ncaptures; n += 2) {
920 e->buf.len += r->captures[2 * n + 1] - r->captures[2 * n]; 920 e->buf.len += r->captures[n + 1] - r->captures[n];
921 } 921 }
922 922
923 } else { 923 } else {
924 ngx_memzero(&le, sizeof(ngx_http_script_engine_t)); 924 ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
925 925