]> git.kaiwu.me - nginx.git/commitdiff
Request body: next upstream fix.
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 14 Mar 2013 12:28:53 +0000 (12:28 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 14 Mar 2013 12:28:53 +0000 (12:28 +0000)
After introduction of chunked request body handling in 1.3.9 (r4931),
r->request_body->bufs buffers have b->start pointing to original buffer
start (and b->pos pointing to real data of this particular buffer).

While this is ok as per se, it caused bad things (usually original request
headers included before the request body) after reinit of the request
chain in ngx_http_upstream_reinit() while sending the request to a next
upstream server (which used to do b->pos = b->start for each buffer
in the request chain).

Patch by Piotr Sikora.

src/http/ngx_http_request_body.c

index cafc5599260f2a2429fb2e63d16caf81642dea34..1d2acb35ed1df81ed6f90fc5ff8ee422a1d89ee9 100644 (file)
@@ -826,7 +826,7 @@ ngx_http_request_body_length_filter(ngx_http_request_t *r, ngx_chain_t *in)
 
         b->temporary = 1;
         b->tag = (ngx_buf_tag_t) &ngx_http_read_client_request_body;
-        b->start = cl->buf->start;
+        b->start = cl->buf->pos;
         b->pos = cl->buf->pos;
         b->last = cl->buf->last;
         b->end = cl->buf->end;
@@ -933,7 +933,7 @@ ngx_http_request_body_chunked_filter(ngx_http_request_t *r, ngx_chain_t *in)
 
                 b->temporary = 1;
                 b->tag = (ngx_buf_tag_t) &ngx_http_read_client_request_body;
-                b->start = cl->buf->start;
+                b->start = cl->buf->pos;
                 b->pos = cl->buf->pos;
                 b->last = cl->buf->last;
                 b->end = cl->buf->end;