[PATCH 07 of 10] Request body: improved c->read->ready flag handling

Maxim Dounin mdounin at mdounin.ru
Fri Mar 15 18:14:21 UTC 2024


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1710526253 -10800
#      Fri Mar 15 21:10:53 2024 +0300
# Node ID 9f3e833ac0e10401d2da60953723d160c1bf4b5e
# Parent  3cd5f5e21b771ba547097e729642cf568ac49932
Request body: improved c->read->ready flag handling.

Previously, the c->read->ready flag was only checked when c->recv() wasn't
able to fill the whole body buffer.  Now the flag is also checked if
the buffer is fully filled.

This ensures that ev->available checks as introduced in 7583:efd71d49bde0
and 7584:9d2ad2fb4423 will be able to prevent reading from the socket
when using event methods other than kqueue or epoll, and when using SSL.

This might be important to avoid looping for a long time when reading
request body from fast clients.

diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -413,7 +413,7 @@ ngx_http_do_read_client_request_body(ngx
                 break;
             }
 
-            if (rb->buf->last < rb->buf->end) {
+            if (!c->read->ready) {
                 break;
             }
         }




More information about the nginx-devel mailing list