Mercurial > hg > nginx
comparison src/core/ngx_proxy_protocol.c @ 8100:251daa98cc87
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 08 Nov 2022 12:48:19 +0300 |
parents | 17d6a537fb1b |
children | 42bc158a47ec |
comparison
equal
deleted
inserted
replaced
8099:17d6a537fb1b | 8100:251daa98cc87 |
---|---|
280 ngx_proxy_protocol_write(ngx_connection_t *c, u_char *buf, u_char *last) | 280 ngx_proxy_protocol_write(ngx_connection_t *c, u_char *buf, u_char *last) |
281 { | 281 { |
282 ngx_uint_t port, lport; | 282 ngx_uint_t port, lport; |
283 | 283 |
284 if (last - buf < NGX_PROXY_PROTOCOL_V1_MAX_HEADER) { | 284 if (last - buf < NGX_PROXY_PROTOCOL_V1_MAX_HEADER) { |
285 ngx_log_error(NGX_LOG_ALERT, c->log, 0, | |
286 "too small buffer for PROXY protocol"); | |
285 return NULL; | 287 return NULL; |
286 } | 288 } |
287 | 289 |
288 if (ngx_connection_local_sockaddr(c, NULL, 0) != NGX_OK) { | 290 if (ngx_connection_local_sockaddr(c, NULL, 0) != NGX_OK) { |
289 return NULL; | 291 return NULL; |