From: Willy Tarreau Date: Thu, 12 Nov 2026 13:56:14 +0000 (+0100) Subject: DEBUG: stream: do not emit debug messages for internal proxies X-Git-Tag: v3.5-dev12~6 X-Git-Url: https://git.kaiwu.me/control.html?a=commitdiff_plain;h=d6f50e678ff5e4781c47137399d11f58189cad33;p=haproxy.git DEBUG: stream: do not emit debug messages for internal proxies The debug mode that is triggered via "haproxy -d" remains helpful in unit tests during development, typically to see HTTP headers being processed. However, for historic reasons it doesn't make any difference between service connections and maintenance connections such as peers or CLI, making it close to useless in environments involving one of these. This patch just eliminates logs for sessions coming from an internal proxy, since this is not something users are expected to deal with nor want to observe. Thus, it finally becomes possible to use "haproxy -d" while a monitoring script polls the CLI or when peers are configured. --- diff --git a/src/frontend.c b/src/frontend.c index 5941d3583..f7e8cc12f 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -106,7 +106,8 @@ int frontend_accept(struct stream *s) } if (unlikely((global.mode & MODE_DEBUG) && conn && - (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)))) { + (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) && + !(fe->cap & PR_CAP_INT))) { char pn[INET6_ADDRSTRLEN]; char alpn[16] = ""; const char *alpn_str = NULL; diff --git a/src/stream.c b/src/stream.c index 87817c2a1..e77afc46b 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2130,7 +2130,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) */ if (unlikely((global.mode & MODE_DEBUG) && (!(global.mode & MODE_QUIET) || - (global.mode & MODE_VERBOSE)))) { + (global.mode & MODE_VERBOSE)) && + !(sess->fe->cap & PR_CAP_INT))) { chunk_printf(&trash, "%08x:%s.clicls[%04x:%04x]\n", s->uniq_id, s->be->id, (unsigned short)conn_fd(sc_conn(scf)), @@ -2167,7 +2168,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) */ if (unlikely((global.mode & MODE_DEBUG) && (!(global.mode & MODE_QUIET) || - (global.mode & MODE_VERBOSE)))) { + (global.mode & MODE_VERBOSE)) && + !(sess->fe->cap & PR_CAP_INT))) { if (s->prev_conn_state == SC_ST_EST) { chunk_printf(&trash, "%08x:%s.srvcls[%04x:%04x]\n", s->uniq_id, s->be->id, @@ -2847,7 +2849,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) _HA_ATOMIC_DEC(&s->be->beconn); if (unlikely((global.mode & MODE_DEBUG) && - (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)))) { + (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) && + !(sess->fe->cap & PR_CAP_INT))) { chunk_printf(&trash, "%08x:%s.closed[%04x:%04x]\n", s->uniq_id, s->be->id, (unsigned short)conn_fd(sc_conn(scf)),