]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: haterm: Properly handle end of request and end of response
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 5 May 2026 14:11:31 +0000 (16:11 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 5 May 2026 17:01:03 +0000 (19:01 +0200)
commitc0f137b7045d6e27e62f890130f8fb707f75150b
tree4cc10e04fcae9048e5f6f98e6f1b829472f538d6
parentb945a3207b814922166e44408b182f577a368713
BUG/MEDIUM: haterm: Properly handle end of request and end of response

There were several issues with the handling of end of the request or end of
response. The main problem was about the request draining.

To help to fix these issues, two flags were introduced:

 * HS_ST_HTTP_EOM_RCVD: to know the request was fully received
 * HS_ST_HTTP_EOM_SENT: to know the response was fully sent

Thanks to these flags some parts were reviewed and simplified.

In the I/O callback function, outside of any error, the hstream task is now
woken when one of the direction is not finished or when there are still some
data in a buffer.

The function hstream_must_drain() was reworked to properly drain request
with no content-length before replying.

The condition to wake hstream up to drain the request after replying was
also reworked, and moved ouside of the else block. Indeed, it must also be
evaluated when the response was fully sent in one call, when request headers
were processed.

Finally, the condition to shut the hstream was slighly adapted to use the
new flags. In addition, we now rely on se_shutdown().
src/haterm.c