comparison src/http/ngx_http_request_body.c @ 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
comparison
equal deleted inserted replaced
9255:208a4adb82ef 9256:43fe0edddba1
224 post_handler(r); 224 post_handler(r);
225 } 225 }
226 226
227 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { 227 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
228 r->main->count--; 228 r->main->count--;
229 r->read_event_handler = ngx_http_block_reading;
229 } 230 }
230 231
231 return rc; 232 return rc;
232 } 233 }
233 234
292 } 293 }
293 294
294 rc = ngx_http_do_read_client_request_body(r); 295 rc = ngx_http_do_read_client_request_body(r);
295 296
296 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { 297 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
298 r->read_event_handler = ngx_http_block_reading;
297 ngx_http_finalize_request(r, rc); 299 ngx_http_finalize_request(r, rc);
298 } 300 }
299 } 301 }
300 302
301 303