mirror of
https://github.com/nginx/nginx.git
synced 2025-01-06 22:23:00 -06:00
Increased maximum read PROXY protocol header size.
Maximum size for reading the PROXY protocol header is increased to 4096 to accommodate a bigger number of TLVs, which are supported since cca4c8a715de. Maximum size for writing the PROXY protocol header is not changed since only version 1 is currently supported.
This commit is contained in:
parent
d7483bf1af
commit
7600ca0286
@ -281,7 +281,7 @@ 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_MAX_HEADER) {
|
||||
if (last - buf < NGX_PROXY_PROTOCOL_V1_MAX_HEADER) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,8 @@
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
||||
#define NGX_PROXY_PROTOCOL_MAX_HEADER 107
|
||||
#define NGX_PROXY_PROTOCOL_V1_MAX_HEADER 107
|
||||
#define NGX_PROXY_PROTOCOL_MAX_HEADER 4096
|
||||
|
||||
|
||||
struct ngx_proxy_protocol_s {
|
||||
|
@ -890,7 +890,7 @@ ngx_mail_proxy_send_proxy_protocol(ngx_mail_session_t *s)
|
||||
u_char *p;
|
||||
ssize_t n, size;
|
||||
ngx_connection_t *c;
|
||||
u_char buf[NGX_PROXY_PROTOCOL_MAX_HEADER];
|
||||
u_char buf[NGX_PROXY_PROTOCOL_V1_MAX_HEADER];
|
||||
|
||||
s->connection->log->action = "sending PROXY protocol header to upstream";
|
||||
|
||||
@ -898,7 +898,7 @@ ngx_mail_proxy_send_proxy_protocol(ngx_mail_session_t *s)
|
||||
"mail proxy send PROXY protocol header");
|
||||
|
||||
p = ngx_proxy_protocol_write(s->connection, buf,
|
||||
buf + NGX_PROXY_PROTOCOL_MAX_HEADER);
|
||||
buf + NGX_PROXY_PROTOCOL_V1_MAX_HEADER);
|
||||
if (p == NULL) {
|
||||
ngx_mail_proxy_internal_server_error(s);
|
||||
return NGX_ERROR;
|
||||
|
@ -894,7 +894,7 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)
|
||||
return;
|
||||
}
|
||||
|
||||
p = ngx_pnalloc(c->pool, NGX_PROXY_PROTOCOL_MAX_HEADER);
|
||||
p = ngx_pnalloc(c->pool, NGX_PROXY_PROTOCOL_V1_MAX_HEADER);
|
||||
if (p == NULL) {
|
||||
ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR);
|
||||
return;
|
||||
@ -902,7 +902,8 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)
|
||||
|
||||
cl->buf->pos = p;
|
||||
|
||||
p = ngx_proxy_protocol_write(c, p, p + NGX_PROXY_PROTOCOL_MAX_HEADER);
|
||||
p = ngx_proxy_protocol_write(c, p,
|
||||
p + NGX_PROXY_PROTOCOL_V1_MAX_HEADER);
|
||||
if (p == NULL) {
|
||||
ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR);
|
||||
return;
|
||||
@ -946,14 +947,15 @@ ngx_stream_proxy_send_proxy_protocol(ngx_stream_session_t *s)
|
||||
ngx_connection_t *c, *pc;
|
||||
ngx_stream_upstream_t *u;
|
||||
ngx_stream_proxy_srv_conf_t *pscf;
|
||||
u_char buf[NGX_PROXY_PROTOCOL_MAX_HEADER];
|
||||
u_char buf[NGX_PROXY_PROTOCOL_V1_MAX_HEADER];
|
||||
|
||||
c = s->connection;
|
||||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_STREAM, c->log, 0,
|
||||
"stream proxy send PROXY protocol header");
|
||||
|
||||
p = ngx_proxy_protocol_write(c, buf, buf + NGX_PROXY_PROTOCOL_MAX_HEADER);
|
||||
p = ngx_proxy_protocol_write(c, buf,
|
||||
buf + NGX_PROXY_PROTOCOL_V1_MAX_HEADER);
|
||||
if (p == NULL) {
|
||||
ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR);
|
||||
return NGX_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user