]> git.kaiwu.me - nginx.git/commit
Request body: restored buffered empty body special case
authorSergey Kandaurov <pluknet@nginx.com>
Fri, 14 Nov 2025 12:06:56 +0000 (16:06 +0400)
committerSergey Kandaurov <s.kandaurov@f5.com>
Thu, 30 Apr 2026 11:09:24 +0000 (15:09 +0400)
commit6eb7dcdd98dcba78d63b7e37a68fbe505e7ed725
tree906ab79cb690808d896a23d2711cfd07594632ed
parent484a9863e71332ab0f4a56bf4f0fec26ce86a791
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 in 4c7f51136 (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 since 2a7092138 (1.21.2).

The fix is to additionally check if it is the only empty buffer.

Found with UndefinedBehaviorSanitizer (pointer-overflow)
src/http/ngx_http_request_body.c