]> git.kaiwu.me - haproxy.git/commitdiff
DEBUG: stream: do not emit debug messages for internal proxies
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Nov 2026 13:56:14 +0000 (14:56 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 12 Nov 2026 17:12:23 +0000 (18:12 +0100)
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.

src/frontend.c
src/stream.c

index 5941d3583f7467f4f8e9741c31db5be7cde5a8f6..f7e8cc12f448ef4b9ff4f7cf33d0ac3341384e30 100644 (file)
@@ -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] = "<none>";
                const char *alpn_str = NULL;
index 87817c2a1eec4d51d748d66777e8eb0c27e268cb..e77afc46b257d124224e8e545282aac40925a6ad 100644 (file)
@@ -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)),