mirror of
https://github.com/nginx/nginx.git
synced 2025-06-13 06:12:44 +08:00
restore discard body handler after ngx_http_set_writer() set it to
ngx_http_test_reading(), the bug was introduced in r3050
This commit is contained in:
parent
7060e670f4
commit
801a35df3c
@ -118,6 +118,7 @@ size_t ngx_http_get_time(char *buf, time_t t);
|
|||||||
|
|
||||||
|
|
||||||
ngx_int_t ngx_http_discard_request_body(ngx_http_request_t *r);
|
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_block_reading(ngx_http_request_t *r);
|
||||||
void ngx_http_test_reading(ngx_http_request_t *r);
|
void ngx_http_test_reading(ngx_http_request_t *r);
|
||||||
|
|
||||||
|
@ -2105,10 +2105,15 @@ ngx_http_finalize_connection(ngx_http_request_t *r)
|
|||||||
|
|
||||||
if (r->main->count != 1) {
|
if (r->main->count != 1) {
|
||||||
|
|
||||||
if (r->discard_body && r->lingering_time == 0) {
|
if (r->discard_body) {
|
||||||
r->lingering_time = ngx_time()
|
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);
|
+ (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);
|
ngx_http_close_request(r, 0);
|
||||||
|
@ -13,7 +13,6 @@ static void ngx_http_read_client_request_body_handler(ngx_http_request_t *r);
|
|||||||
static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r);
|
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,
|
static ngx_int_t ngx_http_write_request_body(ngx_http_request_t *r,
|
||||||
ngx_chain_t *body);
|
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_read_discarded_request_body(ngx_http_request_t *r);
|
||||||
static ngx_int_t ngx_http_test_expect(ngx_http_request_t *r);
|
static ngx_int_t ngx_http_test_expect(ngx_http_request_t *r);
|
||||||
|
|
||||||
@ -470,7 +469,7 @@ ngx_http_discard_request_body(ngx_http_request_t *r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||||
@ -488,8 +487,8 @@ ngx_http_discard_request_body(ngx_http_request_t *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
void
|
||||||
ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r)
|
ngx_http_discarded_request_body_handler(ngx_http_request_t *r)
|
||||||
{
|
{
|
||||||
ngx_int_t rc;
|
ngx_int_t rc;
|
||||||
ngx_msec_t timer;
|
ngx_msec_t timer;
|
||||||
|
Loading…
Reference in New Issue
Block a user