mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 14:13:33 -06:00
Request body: properly handle events while discarding body.
An attempt to call ngx_handle_read_event() before actually reading data from a socket might result in read event being disabled, which is wrong. Catched by body.t test on Solaris.
This commit is contained in:
parent
e1bd52041b
commit
c29837fc4d
@ -482,19 +482,21 @@ ngx_http_discard_request_body(ngx_http_request_t *r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ngx_http_read_discarded_request_body(r) == NGX_OK) {
|
||||||
|
r->lingering_close = 0;
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* == NGX_AGAIN */
|
||||||
|
|
||||||
r->read_event_handler = ngx_http_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_http_read_discarded_request_body(r) == NGX_OK) {
|
r->count++;
|
||||||
r->lingering_close = 0;
|
r->discard_body = 1;
|
||||||
|
|
||||||
} else {
|
|
||||||
r->count++;
|
|
||||||
r->discard_body = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user