aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_request_body.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2013-02-01 14:38:18 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2013-02-01 14:38:18 +0000
commite97e4124e372d2db118d984988632d28f8966130 (patch)
treeabeaa2c201ab30c026c963a85b84deb4a838190d /src/http/ngx_http_request_body.c
parent2887c06fdecbb4eccaf69a9e7fbef55f1b49c2b5 (diff)
downloadnginx-e97e4124e372d2db118d984988632d28f8966130.tar.gz
nginx-e97e4124e372d2db118d984988632d28f8966130.zip
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).
Diffstat (limited to 'src/http/ngx_http_request_body.c')
-rw-r--r--src/http/ngx_http_request_body.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c
index 749e4aedb..cafc55992 100644
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -35,7 +35,8 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
size_t preread;
ssize_t size;
ngx_int_t rc;
- ngx_chain_t out;
+ ngx_buf_t *b;
+ ngx_chain_t out, *cl;
ngx_http_request_body_t *rb;
ngx_http_core_loc_conf_t *clcf;
@@ -128,6 +129,21 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
goto done;
}
+
+ cl = ngx_chain_get_free_buf(r->pool, &rb->free);
+ if (cl == NULL) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ b = cl->buf;
+
+ ngx_memzero(b, sizeof(ngx_buf_t));
+
+ b->in_file = 1;
+ b->file_last = rb->temp_file->file.offset;
+ b->file = &rb->temp_file->file;
+
+ rb->bufs = cl;
}
post_handler(r);