aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-11-16 19:10:45 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-11-16 19:10:45 +0000
commitd86a0bfed491fbaf75d2268856aa999621b7cdf0 (patch)
tree2943e2a23b636c8853327375a2ceee337fc5954d /src
parent93da5659625fa3c04d30cf091bc5d356001d29e1 (diff)
downloadnginx-d86a0bfed491fbaf75d2268856aa999621b7cdf0.tar.gz
nginx-d86a0bfed491fbaf75d2268856aa999621b7cdf0.zip
fix captures in "rewrite", the bug had been introduced in r3326
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_script.c6
-rw-r--r--src/http/ngx_http_variables.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c
index b809e2b98..aa03df007 100644
--- a/src/http/ngx_http_script.c
+++ b/src/http/ngx_http_script.c
@@ -910,14 +910,14 @@ ngx_http_script_regex_start_code(ngx_http_script_engine_t *e)
e->buf.len = code->size;
if (code->uri) {
- if (rc && (r->quoted_uri || r->plus_in_uri)) {
+ if (r->ncaptures && (r->quoted_uri || r->plus_in_uri)) {
e->buf.len += 2 * ngx_escape_uri(NULL, r->uri.data, r->uri.len,
NGX_ESCAPE_ARGS);
}
}
- for (n = 1; n < (ngx_uint_t) rc; n++) {
- e->buf.len += r->captures[2 * n + 1] - r->captures[2 * n];
+ for (n = 2; n < r->ncaptures; n += 2) {
+ e->buf.len += r->captures[n + 1] - r->captures[n];
}
} else {
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index 633b31084..0289a64ac 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -1810,7 +1810,7 @@ ngx_http_regex_exec(ngx_http_request_t *r, ngx_http_regex_t *re, ngx_str_t *s)
#endif
}
- r->ncaptures = len;
+ r->ncaptures = rc * 2;
r->captures_data = s->data;
return NGX_OK;