]> git.kaiwu.me - nginx.git/commitdiff
Added logging to PROXY protocol write buffer check.
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 8 Nov 2022 09:48:19 +0000 (12:48 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 8 Nov 2022 09:48:19 +0000 (12:48 +0300)
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.

src/core/ngx_proxy_protocol.c

index 212763647ccc9ed90d333f61745a147e1fbb0b39..8d3bd01d91a99218b5831f61c129f71b64bc010a 100644 (file)
@@ -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;
     }