fix proxy_redirect with variable

This commit is contained in:
Igor Sysoev 2006-09-26 21:15:52 +00:00
parent 347f7fe4c1
commit c9098081e2

View File

@ -1397,8 +1397,11 @@ ngx_http_proxy_rewrite_redirect_vars(ngx_http_request_t *r, ngx_table_elt_t *h,
e.ip = pr->replacement.vars.lengths;
e.request = r;
for (len = prefix; *(uintptr_t *) e.ip; len += lcode(&e)) {
len = prefix + h->value.len - pr->redirect.len;
while (*(uintptr_t *) e.ip) {
lcode = *(ngx_http_script_len_code_pt *) e.ip;
len += lcode(&e);
}
data = ngx_palloc(r->pool, len);
@ -1418,6 +1421,9 @@ ngx_http_proxy_rewrite_redirect_vars(ngx_http_request_t *r, ngx_table_elt_t *h,
code(&e);
}
ngx_memcpy(e.pos, h->value.data + prefix + pr->redirect.len,
h->value.len - pr->redirect.len - prefix);
h->value.len = len;
h->value.data = data;