Mercurial > hg > nginx-quic
comparison src/http/ngx_http_request_body.c @ 5025:43cb2c9799c1
Request body: fixed client_body_in_file_only.
After introduction of chunked request body reading support in 1.3.9 (r4931),
the rb->bufs wasn't set if request body was fully preread while calling the
ngx_http_read_client_request_body() function.
Reported by Yichun Zhang (agentzh).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 01 Feb 2013 14:38:18 +0000 |
parents | 3b6594a2b79f |
children | 0bbdd966a383 |
comparison
equal
deleted
inserted
replaced
5024:03513220b83b | 5025:43cb2c9799c1 |
---|---|
33 ngx_http_client_body_handler_pt post_handler) | 33 ngx_http_client_body_handler_pt post_handler) |
34 { | 34 { |
35 size_t preread; | 35 size_t preread; |
36 ssize_t size; | 36 ssize_t size; |
37 ngx_int_t rc; | 37 ngx_int_t rc; |
38 ngx_chain_t out; | 38 ngx_buf_t *b; |
39 ngx_chain_t out, *cl; | |
39 ngx_http_request_body_t *rb; | 40 ngx_http_request_body_t *rb; |
40 ngx_http_core_loc_conf_t *clcf; | 41 ngx_http_core_loc_conf_t *clcf; |
41 | 42 |
42 r->main->count++; | 43 r->main->count++; |
43 | 44 |
126 if (r->request_body_in_file_only) { | 127 if (r->request_body_in_file_only) { |
127 if (ngx_http_write_request_body(r) != NGX_OK) { | 128 if (ngx_http_write_request_body(r) != NGX_OK) { |
128 rc = NGX_HTTP_INTERNAL_SERVER_ERROR; | 129 rc = NGX_HTTP_INTERNAL_SERVER_ERROR; |
129 goto done; | 130 goto done; |
130 } | 131 } |
132 | |
133 cl = ngx_chain_get_free_buf(r->pool, &rb->free); | |
134 if (cl == NULL) { | |
135 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
136 } | |
137 | |
138 b = cl->buf; | |
139 | |
140 ngx_memzero(b, sizeof(ngx_buf_t)); | |
141 | |
142 b->in_file = 1; | |
143 b->file_last = rb->temp_file->file.offset; | |
144 b->file = &rb->temp_file->file; | |
145 | |
146 rb->bufs = cl; | |
131 } | 147 } |
132 | 148 |
133 post_handler(r); | 149 post_handler(r); |
134 | 150 |
135 return NGX_OK; | 151 return NGX_OK; |