From b238c08015e986da330252cd6197f185308fca57 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 26 May 2026 15:30:33 +0200 Subject: [PATCH] MINOR: h1: Add a H1M flag to specify a non-empty 'Upgrade:' header was parsed H1_MF_UPG_HDR flags was introduced to let H1 parser knwon a non-empty 'Upgrade:' header was parsed. This patch is mandatory to fix a bug. --- include/haproxy/h1.h | 2 +- src/h1.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/haproxy/h1.h b/include/haproxy/h1.h index 25d3e5fd0..84c9d9217 100644 --- a/include/haproxy/h1.h +++ b/include/haproxy/h1.h @@ -98,7 +98,7 @@ enum h1m_state { #define H1_MF_UPG_WEBSOCKET 0x00008000 // Set for a Websocket upgrade handshake #define H1_MF_TE_CHUNKED 0x00010000 // T-E "chunked" #define H1_MF_TE_OTHER 0x00020000 // T-E other than supported ones found (only "chunked" is supported for now) -/* unused: 0x00040000 */ +#define H1_MF_UPG_HDR 0x00040000 // non-empty Upgrapde header found #define H1_MF_NOT_HTTP 0x00080000 // Not an HTTP message (e.g "RTSP", only possible if invalid message are accepted) /* Mask to use to reset H1M flags when we restart headers parsing. * diff --git a/src/h1.c b/src/h1.c index 98bb492b2..7a88fb192 100644 --- a/src/h1.c +++ b/src/h1.c @@ -316,6 +316,9 @@ void h1_parse_upgrade_header(struct h1m *h1m, struct ist *value) skip_val: word.ptr = p = n; } + + if (istlen(*value)) + h1m->flags |= H1_MF_UPG_HDR; } /* Macros used in the HTTP/1 parser, to check for the expected presence of