summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_request_body.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2010-02-01 14:42:38 +0000
committerIgor Sysoev <igor@sysoev.ru>2010-02-01 14:42:38 +0000
commitce7f11c6d0b74a8e93e22d7995d652e020de785c (patch)
treed831aabb427e29eb597aed840d76604aef2d05e7 /src/http/ngx_http_request_body.c
parent7a03f30dd26452476a4e565faecb3258a4f66ec3 (diff)
downloadnginx-ce7f11c6d0b74a8e93e22d7995d652e020de785c.tar.gz
nginx-ce7f11c6d0b74a8e93e22d7995d652e020de785c.tar.bz2
merge r3163, r3213:
*) fix discarding body *) prevent handling discarded body as a pipelined request
Diffstat (limited to 'src/http/ngx_http_request_body.c')
-rw-r--r--src/http/ngx_http_request_body.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c
index 9d47300f5..07f023dd6 100644
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -458,6 +458,7 @@ ngx_http_discard_request_body(ngx_http_request_t *r)
if (size) {
if (r->headers_in.content_length_n > size) {
+ r->header_in->pos += size;
r->headers_in.content_length_n -= size;
} else {
@@ -559,12 +560,16 @@ ngx_http_read_discarded_request_body(ngx_http_request_t *r)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http read discarded body");
- do {
+ for ( ;; ) {
if (r->headers_in.content_length_n == 0) {
r->read_event_handler = ngx_http_block_reading;
return NGX_OK;
}
+ if (!r->connection->read->ready) {
+ return NGX_AGAIN;
+ }
+
size = (r->headers_in.content_length_n > NGX_HTTP_DISCARD_BUFFER_SIZE) ?
NGX_HTTP_DISCARD_BUFFER_SIZE:
(size_t) r->headers_in.content_length_n;
@@ -585,10 +590,7 @@ ngx_http_read_discarded_request_body(ngx_http_request_t *r)
}
r->headers_in.content_length_n -= n;
-
- } while (r->connection->read->ready);
-
- return NGX_AGAIN;
+ }
}