mirror of
https://github.com/nginx/nginx.git
synced 2026-05-13 09:36:42 +00:00
Request body: restored buffered empty body special case
This restores a long-standing optimization when the entire request body is empty and r->request_body_in_file_only is set, used to avoid writing an empty file as initially introduced in4c7f51136(0.4.4). The previous condition never worked with chunked body filter, where rb->bufs holds at least the final chunk; in length body filter, it is used to indicate the last received buffer since2a7092138(1.21.2). The fix is to additionally check if it is the only empty buffer. Found with UndefinedBehaviorSanitizer (pointer-overflow)
This commit is contained in:
parent
484a9863e7
commit
6eb7dcdd98
1 changed files with 3 additions and 1 deletions
|
|
@ -581,7 +581,9 @@ ngx_http_write_request_body(ngx_http_request_t *r)
|
|||
|
||||
rb->temp_file = tf;
|
||||
|
||||
if (rb->bufs == NULL) {
|
||||
if (rb->bufs == NULL
|
||||
|| (!ngx_buf_in_memory(rb->bufs->buf) && rb->bufs->buf->last_buf))
|
||||
{
|
||||
/* empty body with r->request_body_in_file_only */
|
||||
|
||||
if (ngx_create_temp_file(&tf->file, tf->path, tf->pool,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue