]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h1: Add a H1M flag to specify a non-empty 'Upgrade:' header was parsed
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 26 May 2026 13:30:33 +0000 (15:30 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 26 May 2026 16:28:07 +0000 (18:28 +0200)
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
src/h1.c

index 25d3e5fd028c8053650bc438653ba201914c734b..84c9d921779c8cfc88b53077129db3a1ea92d836 100644 (file)
@@ -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.
  *
index 98bb492b25dc7fd6c06a8aa30db91e9f07f09ce2..7a88fb192d5aceb1a8b61a029e8cb34b618bf37c 100644 (file)
--- 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