changeset 9255:208a4adb82ef

Request body: logging of timeouts.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 27 Apr 2024 18:19:27 +0300
parents cb1e214efe41
children 43fe0edddba1
files src/http/ngx_http_request_body.c src/http/ngx_http_upstream.c src/http/v2/ngx_http_v2.c src/http/v3/ngx_http_v3_request.c
diffstat 4 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -262,6 +262,8 @@ ngx_http_read_unbuffered_request_body(ng
 #endif
 
     if (r->connection->read->timedout) {
+        ngx_log_error(NGX_LOG_INFO, r->connection->log, NGX_ETIMEDOUT,
+                      "client timed out");
         r->connection->timedout = 1;
         return NGX_HTTP_REQUEST_TIME_OUT;
     }
@@ -282,6 +284,8 @@ ngx_http_read_client_request_body_handle
     ngx_int_t  rc;
 
     if (r->connection->read->timedout) {
+        ngx_log_error(NGX_LOG_INFO, r->connection->log, NGX_ETIMEDOUT,
+                      "client timed out");
         r->connection->timedout = 1;
         ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT);
         return;
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2361,6 +2361,7 @@ ngx_http_upstream_read_request_handler(n
 
     if (c->read->timedout) {
         c->timedout = 1;
+        ngx_connection_error(c, NGX_ETIMEDOUT, "client timed out");
         ngx_http_upstream_finalize_request(r, u, NGX_HTTP_REQUEST_TIME_OUT);
         return;
     }
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -4285,6 +4285,9 @@ ngx_http_v2_read_unbuffered_request_body
 
     if (fc->read->timedout) {
         if (stream->recv_window) {
+            ngx_log_error(NGX_LOG_INFO, fc->log, NGX_ETIMEDOUT,
+                          "client timed out");
+
             stream->skip_data = 1;
             fc->timedout = 1;
 
--- a/src/http/v3/ngx_http_v3_request.c
+++ b/src/http/v3/ngx_http_v3_request.c
@@ -1281,6 +1281,8 @@ ngx_http_v3_read_client_request_body_han
     ngx_int_t  rc;
 
     if (r->connection->read->timedout) {
+        ngx_log_error(NGX_LOG_INFO, r->connection->log, NGX_ETIMEDOUT,
+                      "client timed out");
         r->connection->timedout = 1;
         ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT);
         return;
@@ -1300,6 +1302,8 @@ ngx_http_v3_read_unbuffered_request_body
     ngx_int_t  rc;
 
     if (r->connection->read->timedout) {
+        ngx_log_error(NGX_LOG_INFO, r->connection->log, NGX_ETIMEDOUT,
+                      "client timed out");
         r->connection->timedout = 1;
         return NGX_HTTP_REQUEST_TIME_OUT;
     }