]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: h1-htx: Don't report EOM for H1 interim responses during parsing
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Sep 2026 05:34:13 +0000 (07:34 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Sep 2026 12:05:25 +0000 (14:05 +0200)
Commit b7467ca91 ("MAJOR: htx: Use htx_set_eom() instead of setting
HTX_FL_EOM by hand") introduced a regression. During H1 response parsing,
the end of the message was reported in 1XX interim responses, while it
should not. Because of this issue, a BUG_ON() was triggered on the final
response parsing.

The calls to htx_set_eom() function in h1_postparse_req_hdrs() and
h1_postparse_res_hdrs() was factorized to be always set when the parser
reached H1_MSG_DONE state. This was obviously wrong for 1XX interim
messages.

Thanks to Adam Crawford for reporting this issue.

It is a 3.5-specific issue. No backport needed.

src/h1_htx.c

index 24daf0a3cebb013230679d47c1161cd7ad0d545d..b1f500043ea0f91828e9b35b11884cd359ef95a9 100644 (file)
@@ -377,7 +377,10 @@ static int h1_postparse_res_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
                goto error;
        sl->info.res.status = code;
 
-       if (h1m->state == H1_MSG_DONE)
+       /* The EOM must not be reported for 1xx interim responses. The final
+        * response is expected next.
+        */
+       if (h1m->state == H1_MSG_DONE && (code >= 200 || code == 101))
                htx_set_eom(htx);
        return 1;