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.
This commit is contained in:
Maxim Dounin 2022-11-08 12:48:19 +03:00
parent 1d87a364e9
commit ff6c0947b8
1 changed files with 2 additions and 0 deletions

View 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;
}