diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2015-03-26 02:31:30 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2015-03-26 02:31:30 +0300 |
commit | 5e96e84ffbd95567c53709dc8cffdfc58e5b56a2 (patch) | |
tree | ae61696ccdbc9a05c38205320d60d3ef25186459 | |
parent | 4a285bbd6c29a8f12e2915b1b80662cd0861321b (diff) | |
download | nginx-5e96e84ffbd95567c53709dc8cffdfc58e5b56a2.tar.gz |
Proxy: fixed proxy_request_buffering and chunked with preread body.
If any preread body bytes were sent in the first chain, chunk size was
incorrectly added before the whole chain, including header, resulting in
an invalid request sent to upstream. Fixed to properly add chunk size
after the header.
-rw-r--r-- | src/http/modules/ngx_http_proxy_module.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c index d0b1c885d..00e8923a0 100644 --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -1503,7 +1503,7 @@ ngx_http_proxy_body_output_filter(void *data, ngx_chain_t *in) u_char *chunk; ngx_int_t rc; ngx_buf_t *b; - ngx_chain_t *out, *cl, *tl, **ll; + ngx_chain_t *out, *cl, *tl, **ll, **fl; ngx_http_proxy_ctx_t *ctx; ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, @@ -1546,6 +1546,7 @@ ngx_http_proxy_body_output_filter(void *data, ngx_chain_t *in) size = 0; cl = in; + fl = ll; for ( ;; ) { ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, @@ -1602,8 +1603,8 @@ ngx_http_proxy_body_output_filter(void *data, ngx_chain_t *in) b->pos = chunk; b->last = ngx_sprintf(chunk, "%xO" CRLF, size); - tl->next = out; - out = tl; + tl->next = *fl; + *fl = tl; } if (cl->buf->last_buf) { |