]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http-ana: Don't wait to have an empty buf to switch in TUNNEL state
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 8 Jul 2022 07:22:17 +0000 (09:22 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 8 Jul 2022 14:37:31 +0000 (16:37 +0200)
When we want to establish a tunnel on a side, we wait to have flush all data
from the buffer. At this stage the other side is at least in DONE state. But
there is no real reason to wait. We are already in DONE state on its
side. So all the HTTP message was already forwarded or planned to be
forwarded. Depending on the scheduling if the mux already started to
transfer tunneled data, these data may block the switch in TUNNEL state and
thus block these data infinitly.

This bug exists since the early days of HTX. May it was mandatory but today
it seems useless. But I honestly don't remember why this prerequisite was
added. So be careful during the backports.

This patch should be backported with caution. At least as far as 2.4. For
2.2 and 2.0, it seems to be mandatory too. But a review must be performed.

src/http_ana.c

index 021ad753b44ee9ce65d995c0f95db63e418549ce..4b74dd60d029b1870ef892c4fbaa34aa1a628004 100644 (file)
@@ -4433,10 +4433,6 @@ static void http_end_request(struct stream *s)
                         * poll for reads.
                         */
                        channel_auto_read(chn);
-                       if (b_data(&chn->buf)) {
-                               DBG_TRACE_DEVEL("waiting to flush the request", STRM_EV_HTTP_ANA, s, txn);
-                               return;
-                       }
                        txn->req.msg_state = HTTP_MSG_TUNNEL;
                }
                else {
@@ -4556,10 +4552,6 @@ static void http_end_response(struct stream *s)
                 */
                if (txn->flags & TX_CON_WANT_TUN) {
                        channel_auto_read(chn);
-                       if (b_data(&chn->buf)) {
-                               DBG_TRACE_DEVEL("waiting to flush the respone", STRM_EV_HTTP_ANA, s, txn);
-                               return;
-                       }
                        txn->rsp.msg_state = HTTP_MSG_TUNNEL;
                }
                else {