Opened 5 years ago
Closed 5 years ago
#1771 closed defect (invalid)
the buffer used to send PROXY protocol header to upstream do not reused in stream module
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | trivial | Milestone: | |
Component: | nginx-module | Version: | 1.15.x |
Keywords: | Cc: | ||
uname -a: | |||
nginx -V: | 1.15.12 |
Description
function ngx_stream_proxy_init_upstream in ngx_stream_proxy_module.c, line840.
the buffer(cl->buf) used to send PROXY protocol header to upstream, while cl->buf->start and cl->buf->end is set to be zero, so the buffer is unable to reuse.
Is this a feature or mistake?
if (u->proxy_protocol) { ngx_log_debug0(NGX_LOG_DEBUG_STREAM, c->log, 0, "stream proxy add PROXY protocol header"); cl = ngx_chain_get_free_buf(c->pool, &u->free); if (cl == NULL) { ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR); return; } p = ngx_pnalloc(c->pool, NGX_PROXY_PROTOCOL_MAX_HEADER); if (p == NULL) { ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR); return; } cl->buf->pos = p; p = ngx_proxy_protocol_write(c, p, p + NGX_PROXY_PROTOCOL_MAX_HEADER); if (p == NULL) { ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR); return; } cl->buf->last = p; cl->buf->temporary = 1; cl->buf->flush = 0; cl->buf->last_buf = 0; cl->buf->tag = (ngx_buf_tag_t) &ngx_stream_proxy_module; cl->next = u->upstream_out; u->upstream_out = cl; u->proxy_protocol = 0; }
Note:
See TracTickets
for help on using tickets.
Doesn't look like a bug to me. For questions, consider using support options available.