aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2022-11-08 12:48:19 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2022-11-08 12:48:19 +0300
commitfbe42d46312a87ee24f9038f26876a95c7abab34 (patch)
treee94ec8679cd50640b965f1d0c12048984bd36aa0
parent7600ca028644d3ecc7e62499d71bbe21fe3bda0d (diff)
downloadnginx-fbe42d46312a87ee24f9038f26876a95c7abab34.tar.gz
nginx-fbe42d46312a87ee24f9038f26876a95c7abab34.zip
Added logging to PROXY protocol write buffer check.
The check is not expected to fail unless there is a bug in the calling code. But given the check is here, it should log an alert if it fails instead of silently closing the connection.
-rw-r--r--src/core/ngx_proxy_protocol.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/ngx_proxy_protocol.c b/src/core/ngx_proxy_protocol.c
index 212763647..8d3bd01d9 100644
--- a/src/core/ngx_proxy_protocol.c
+++ b/src/core/ngx_proxy_protocol.c
@@ -282,6 +282,8 @@ ngx_proxy_protocol_write(ngx_connection_t *c, u_char *buf, u_char *last)
ngx_uint_t port, lport;
if (last - buf < NGX_PROXY_PROTOCOL_V1_MAX_HEADER) {
+ ngx_log_error(NGX_LOG_ALERT, c->log, 0,
+ "too small buffer for PROXY protocol");
return NULL;
}