From b72d98a619442cd52d86bb4786b867f1aed4c8a7 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Fri, 30 Nov 2018 13:17:48 +0100 Subject: [PATCH] BUG/MEDIUM: mux_pt: Don't try to send if handshake is not done. While it is true the SSL code will do the right thing if the SSL handshake is not done, we have other types of handshake to deal with (proxy protocol, netscaler, ...). For those we definitively don't want to try to send data before it's done. All handshakes but SSL will go through the mux_pt, so in mux_pt_snd_buf, don't try to send while a handshake is pending. --- src/mux_pt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mux_pt.c b/src/mux_pt.c index 1f0f3e5a0..9dec13216 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -253,7 +253,11 @@ static size_t mux_pt_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t /* Called from the upper layer, to send data */ static size_t mux_pt_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t count, int flags) { - size_t ret = cs->conn->xprt->snd_buf(cs->conn, buf, count, flags); + size_t ret; + + if (cs->conn->flags & CO_FL_HANDSHAKE) + return 0; + ret = cs->conn->xprt->snd_buf(cs->conn, buf, count, flags); if (ret > 0) b_del(buf, ret);