comparison src/http/ngx_http_request_body.c @ 4005:e56c1e9873cb

Correctly set body if it's preread and there are extra data. 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.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 18 Aug 2011 15:27:57 +0000
parents 798a7f1d3b2f
children 87f47e05fc82
comparison
equal deleted inserted replaced
4004:84bd993b8cd3 4005:e56c1e9873cb
141 141
142 /* the whole request body was pre-read */ 142 /* the whole request body was pre-read */
143 143
144 r->header_in->pos += (size_t) r->headers_in.content_length_n; 144 r->header_in->pos += (size_t) r->headers_in.content_length_n;
145 r->request_length += r->headers_in.content_length_n; 145 r->request_length += r->headers_in.content_length_n;
146 b->last = r->header_in->pos;
146 147
147 if (r->request_body_in_file_only) { 148 if (r->request_body_in_file_only) {
148 if (ngx_http_write_request_body(r, rb->bufs) != NGX_OK) { 149 if (ngx_http_write_request_body(r, rb->bufs) != NGX_OK) {
149 return NGX_HTTP_INTERNAL_SERVER_ERROR; 150 return NGX_HTTP_INTERNAL_SERVER_ERROR;
150 } 151 }