[PATCH 05 of 14] Request body: provided log action for reading request body

Maxim Dounin mdounin at mdounin.ru
Sat Apr 20 00:59:53 UTC 2024


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1713574634 -10800
#      Sat Apr 20 03:57:14 2024 +0300
# Node ID 7997083c8deb47dd84b2f2d323ac404d370d704a
# Parent  e59f07d8682810caa6693f707928593651fb9038
Request body: provided log action for reading request body.

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
@@ -85,6 +85,8 @@ ngx_http_read_client_request_body(ngx_ht
         return NGX_OK;
     }
 
+    r->connection->log->action = "reading request body";
+
 #if (NGX_HTTP_V2)
     if (r->stream) {
         rc = ngx_http_v2_read_request_body(r);
@@ -159,6 +161,7 @@ ngx_http_read_client_request_body(ngx_ht
     if (rb->rest == 0 && rb->last_saved) {
         /* the whole request body was pre-read */
         r->request_body_no_buffering = 0;
+        r->connection->log->action = NULL;
         post_handler(r);
         return NGX_OK;
     }
@@ -217,6 +220,7 @@ done:
         }
 
         r->read_event_handler = ngx_http_block_reading;
+        r->connection->log->action = NULL;
         post_handler(r);
     }
 
@@ -456,6 +460,7 @@ ngx_http_do_read_client_request_body(ngx
 
     if (!r->request_body_no_buffering) {
         r->read_event_handler = ngx_http_block_reading;
+        r->connection->log->action = NULL;
         rb->post_handler(r);
     }
 
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -3807,6 +3807,7 @@ ngx_http_v2_read_request_body(ngx_http_r
 
     if (stream->skip_data) {
         r->request_body_no_buffering = 0;
+        r->connection->log->action = NULL;
         rb->post_handler(r);
         return NGX_OK;
     }
@@ -4061,6 +4062,7 @@ ngx_http_v2_process_request_body(ngx_htt
     }
 
     r->read_event_handler = ngx_http_block_reading;
+    r->connection->log->action = NULL;
     rb->post_handler(r);
 
     return NGX_OK;
diff --git a/src/http/v3/ngx_http_v3_request.c b/src/http/v3/ngx_http_v3_request.c
--- a/src/http/v3/ngx_http_v3_request.c
+++ b/src/http/v3/ngx_http_v3_request.c
@@ -1250,6 +1250,7 @@ ngx_http_v3_read_request_body(ngx_http_r
     if (rb->rest == 0 && rb->last_saved) {
         /* the whole request body was pre-read */
         r->request_body_no_buffering = 0;
+        r->connection->log->action = NULL;
         rb->post_handler(r);
         return NGX_OK;
     }
@@ -1472,6 +1473,7 @@ ngx_http_v3_do_read_client_request_body(
 
     if (!r->request_body_no_buffering) {
         r->read_event_handler = ngx_http_block_reading;
+        r->connection->log->action = NULL;
         rb->post_handler(r);
     }
 




More information about the nginx-devel mailing list