[PATCH 06 of 14] Request body: logging of timeouts
Maxim Dounin
mdounin at mdounin.ru
Sat Apr 20 00:59:54 UTC 2024
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1713574635 -10800
# Sat Apr 20 03:57:15 2024 +0300
# Node ID 4476851eed617ebc2c0125ab208c98d9634742e1
# Parent 7997083c8deb47dd84b2f2d323ac404d370d704a
Request body: logging of timeouts.
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
@@ -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;
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- 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;
}
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
@@ -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;
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
@@ -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;
}
More information about the nginx-devel
mailing list