]> git.kaiwu.me - nginx.git/commitdiff
Correctly set body if it's preread and there are extra data.
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 18 Aug 2011 15:27:57 +0000 (15:27 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 18 Aug 2011 15:27:57 +0000 (15:27 +0000)
Previously all available data was used as body, resulting in garbage after
real body e.g. in case of pipelined requests.  Make sure to use only as many
bytes as request's Content-Length specifies.

src/http/ngx_http_request_body.c

index be311a6129f7c75c485d00d5db34c3269238620c..57c201b9bb5d359f99e0333e53b8b54ccadb5baf 100644 (file)
@@ -143,6 +143,7 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
 
             r->header_in->pos += (size_t) r->headers_in.content_length_n;
             r->request_length += r->headers_in.content_length_n;
+            b->last = r->header_in->pos;
 
             if (r->request_body_in_file_only) {
                 if (ngx_http_write_request_body(r, rb->bufs) != NGX_OK) {