diff options
author | Igor Sysoev <igor@sysoev.ru> | 2006-09-26 21:15:52 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2006-09-26 21:15:52 +0000 |
commit | c9098081e2086757d089658bab60f5903af91d33 (patch) | |
tree | 57a0b352d739f5d509b59578a131c13489fa3e15 /src/http/modules/ngx_http_proxy_module.c | |
parent | 347f7fe4c114e561b957a63dd7c748e6eebfae93 (diff) | |
download | nginx-c9098081e2086757d089658bab60f5903af91d33.tar.gz nginx-c9098081e2086757d089658bab60f5903af91d33.zip |
fix proxy_redirect with variable
Diffstat (limited to 'src/http/modules/ngx_http_proxy_module.c')
-rw-r--r-- | src/http/modules/ngx_http_proxy_module.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c index 0d80b3143..f4007be8e 100644 --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -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; |