]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h1: do not forget EOH even when no header is sent
authorWilly Tarreau <w@1wt.eu>
Wed, 9 Aug 2023 09:58:15 +0000 (11:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 9 Aug 2023 09:58:15 +0000 (11:58 +0200)
Since commit 723c73f8a ("MEDIUM: mux-h1: Split h1_process_mux() to make
code more readable"), outgoing H1 requests with no header at all (i.e.
essentially HTTP/1.0 requests) get delayed by 200ms. Christopher found
that it's due to the fact that we end processing too early and we don't
have the opportunity to send the EOH in this case.

This fix addresses it by verifying if it's required to emit EOH when
retruning from h1_make_headers(). But maybe that block could be moved
after the while loop in fact, or the stop condition in the loop be
revisited not to stop of !htx_is_empty(). The current solution gets the
job done at least.

No backport is needed, this was in 2.9-dev.

src/mux_h1.c

index 2d84724fba215ab74c1877c22bfb54c9a659d7c4..680c0baa7575fb16189ce7d44e9948e627d8b598 100644 (file)
@@ -2956,6 +2956,8 @@ static size_t h1_process_mux(struct h1c *h1c, struct buffer *buf, size_t count)
 
                        case H1_MSG_HDR_NAME:
                                ret = h1_make_headers(h1s, h1m, htx, count);
+                               if (unlikely(h1m->state == H1_MSG_LAST_LF)) // in case of no header
+                                       ret += h1_make_eoh(h1s, h1m, htx, count);
                                break;
 
                        case H1_MSG_LAST_LF: