Mercurial > hg > nginx
changeset 9256:43fe0edddba1
Request body: block reading when returning errors.
If reading is not blocked, additional client activity can result in
undefined behaviour, including segfaults, as seen with proxying with
proxy_ignore_client_abort before 4072:cf334deeea66. While unlikely
with low-level errors being returned when reading the request body, it
might be the case, for example, when chunked transfer encoding is used,
and error_page 400 (or 413) is proxied with proxy_ignore_client_abort.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 27 Apr 2024 18:20:17 +0300 |
parents | 208a4adb82ef |
children | 0748264a1278 |
files | src/http/ngx_http_request_body.c |
diffstat | 1 files changed, 2 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/ngx_http_request_body.c Sat Apr 27 18:19:27 2024 +0300 +++ b/src/http/ngx_http_request_body.c Sat Apr 27 18:20:17 2024 +0300 @@ -226,6 +226,7 @@ if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { r->main->count--; + r->read_event_handler = ngx_http_block_reading; } return rc; @@ -294,6 +295,7 @@ rc = ngx_http_do_read_client_request_body(r); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { + r->read_event_handler = ngx_http_block_reading; ngx_http_finalize_request(r, rc); } }