fix discarding body

This commit is contained in:
Igor Sysoev 2009-09-25 11:55:33 +00:00
parent f774310fb2
commit 03f5b99e8f

View file

@ -562,12 +562,16 @@ ngx_http_read_discarded_request_body(ngx_http_request_t *r)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http read discarded body"); "http read discarded body");
do { for ( ;; ) {
if (r->headers_in.content_length_n == 0) { if (r->headers_in.content_length_n == 0) {
r->read_event_handler = ngx_http_block_reading; r->read_event_handler = ngx_http_block_reading;
return NGX_OK; return NGX_OK;
} }
if (!r->connection->read->ready) {
return NGX_AGAIN;
}
size = (r->headers_in.content_length_n > NGX_HTTP_DISCARD_BUFFER_SIZE) ? size = (r->headers_in.content_length_n > NGX_HTTP_DISCARD_BUFFER_SIZE) ?
NGX_HTTP_DISCARD_BUFFER_SIZE: NGX_HTTP_DISCARD_BUFFER_SIZE:
(size_t) r->headers_in.content_length_n; (size_t) r->headers_in.content_length_n;
@ -588,10 +592,7 @@ ngx_http_read_discarded_request_body(ngx_http_request_t *r)
} }
r->headers_in.content_length_n -= n; r->headers_in.content_length_n -= n;
}
} while (r->connection->read->ready);
return NGX_AGAIN;
} }