BUG/MEDIUM: http-ana: Don't wait to have an empty buf to switch in TUNNEL state

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.
This commit is contained in:
Christopher Faulet 2022-07-08 09:22:17 +02:00
parent 5966e40641
commit 52fc0cbaad

View 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 {