Mercurial > hg > nginx
changeset 3214:798a7f1d3b2f
restore discard body handler after ngx_http_set_writer() set it to
ngx_http_test_reading(), the bug was introduced in r3050
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 19 Oct 2009 16:12:13 +0000 |
parents | 7fc06314c684 |
children | 4edf28522d24 |
files | src/http/ngx_http.h src/http/ngx_http_request.c src/http/ngx_http_request_body.c |
diffstat | 3 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/ngx_http.h Mon Oct 19 16:06:57 2009 +0000 +++ b/src/http/ngx_http.h Mon Oct 19 16:12:13 2009 +0000 @@ -118,6 +118,7 @@ ngx_int_t ngx_http_discard_request_body(ngx_http_request_t *r); +void ngx_http_discarded_request_body_handler(ngx_http_request_t *r); void ngx_http_block_reading(ngx_http_request_t *r); void ngx_http_test_reading(ngx_http_request_t *r);
--- a/src/http/ngx_http_request.c Mon Oct 19 16:06:57 2009 +0000 +++ b/src/http/ngx_http_request.c Mon Oct 19 16:12:13 2009 +0000 @@ -2105,10 +2105,15 @@ if (r->main->count != 1) { - if (r->discard_body && r->lingering_time == 0) { - r->lingering_time = ngx_time() + if (r->discard_body) { + r->read_event_handler = ngx_http_discarded_request_body_handler; + r->write_event_handler = ngx_http_request_empty_handler; + + if (r->lingering_time == 0) { + r->lingering_time = ngx_time() + (time_t) (clcf->lingering_time / 1000); - ngx_add_timer(r->connection->read, clcf->lingering_timeout); + ngx_add_timer(r->connection->read, clcf->lingering_timeout); + } } ngx_http_close_request(r, 0);
--- a/src/http/ngx_http_request_body.c Mon Oct 19 16:06:57 2009 +0000 +++ b/src/http/ngx_http_request_body.c Mon Oct 19 16:12:13 2009 +0000 @@ -13,7 +13,6 @@ static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r); static ngx_int_t ngx_http_write_request_body(ngx_http_request_t *r, ngx_chain_t *body); -static void ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r); static ngx_int_t ngx_http_read_discarded_request_body(ngx_http_request_t *r); static ngx_int_t ngx_http_test_expect(ngx_http_request_t *r); @@ -470,7 +469,7 @@ } } - r->read_event_handler = ngx_http_read_discarded_request_body_handler; + r->read_event_handler = ngx_http_discarded_request_body_handler; if (ngx_handle_read_event(rev, 0) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; @@ -488,8 +487,8 @@ } -static void -ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r) +void +ngx_http_discarded_request_body_handler(ngx_http_request_t *r) { ngx_int_t rc; ngx_msec_t timer;