BUG/MINOR: mux-h1: Fix splicing for messages with unknown length
Splicing was disabled fo Messages with an unknown length (no C-L or T-E
header) with no valid reason. So now, it is possible to use the kernel
splicing for such messages.
This patch should be backported as far as 2.4.
(cherry picked from commit f5ce320156c1a1233755440dad766e7b2b401c0a)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit a04ccb116df4f54564990638076840d61e31507e)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/mux_h1.c b/src/mux_h1.c
index 7372d19..f9a6120 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -1695,8 +1695,7 @@
}
/* Here h1s->cs is always defined */
- if (!(h1m->flags & H1_MF_CHNK) &&
- ((h1m->state == H1_MSG_DATA && h1m->curr_len) || (h1m->state == H1_MSG_TUNNEL))) {
+ if (!(h1m->flags & H1_MF_CHNK) && (h1m->state == H1_MSG_DATA || (h1m->state == H1_MSG_TUNNEL))) {
TRACE_STATE("notify the mux can use splicing", H1_EV_RX_DATA|H1_EV_RX_BODY, h1c->conn, h1s);
h1s->cs->flags |= CS_FL_MAY_SPLICE;
}
@@ -3538,11 +3537,11 @@
goto end;
}
- if (h1m->state == H1_MSG_DATA && count > h1m->curr_len)
+ if (h1m->state == H1_MSG_DATA && (h1m->flags & H1_MF_CLEN) && count > h1m->curr_len)
count = h1m->curr_len;
ret = cs->conn->xprt->rcv_pipe(cs->conn, cs->conn->xprt_ctx, pipe, count);
if (ret >= 0) {
- if (h1m->state == H1_MSG_DATA) {
+ if (h1m->state == H1_MSG_DATA && (h1m->flags & H1_MF_CLEN)) {
if (ret > h1m->curr_len) {
h1s->flags |= H1S_F_PARSING_ERROR;
h1c->flags |= H1C_F_ST_ERROR;
@@ -3598,7 +3597,7 @@
}
ret = cs->conn->xprt->snd_pipe(cs->conn, cs->conn->xprt_ctx, pipe);
- if (h1m->state == H1_MSG_DATA) {
+ if (h1m->state == H1_MSG_DATA && (h1m->flags & H1_MF_CLEN)) {
if (ret > h1m->curr_len) {
h1s->flags |= H1S_F_PROCESSING_ERROR;
h1c->flags |= H1C_F_ST_ERROR;