BUG/MINOR: mux-h1: Enable keep-alive on server side
Don't force the close on server side anymore. Since commit 7c6f8b146 ("MAJOR:
connections: Detach connections from streams"), it is possible to release a
stream without the underlying connection.
Because of this change, we must be sure to create a new stream to handle the
next HTTP transaction only on the client side. And we must be sure to correctly
handle the read0 event in h1_recv, to be sure to call h1_process().
diff --git a/src/mux_h1.c b/src/mux_h1.c
index cbbcd90..66d12cc 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -613,10 +613,6 @@
/* If KAL, check if the backend is stopping. If yes, switch in CLO mode */
if (h1s->flags & H1S_F_WANT_KAL && be->state == PR_STSTOPPED)
h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO;
-
- /* TODO: For now on the server-side, we disable keep-alive */
- if (h1s->flags & H1S_F_WANT_KAL)
- h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO;
}
static void h1_update_req_conn_hdr(struct h1s *h1s, struct h1m *h1m,
@@ -1351,6 +1347,8 @@
if (h1_recv_allowed(h1c))
conn->xprt->subscribe(conn, SUB_CAN_RECV, &h1c->wait_event);
+ else
+ rcvd = 1;
end:
if (!b_data(&h1c->ibuf))
@@ -1462,7 +1460,7 @@
conn->flags & CO_FL_ERROR ||
conn_xprt_read0_pending(conn))
goto release;
- if (!(h1c->flags & (H1C_F_CS_SHUTW_NOW|H1C_F_CS_SHUTW))) {
+ if (!conn_is_back(conn) && !(h1c->flags & (H1C_F_CS_SHUTW_NOW|H1C_F_CS_SHUTW))) {
if (!h1s_create(h1c, NULL))
goto release;
}
@@ -1486,7 +1484,7 @@
ret = h1_send(h1c);
if (!(h1c->wait_event.wait_reason & SUB_CAN_RECV))
ret |= h1_recv(h1c);
- if (ret/* || b_data(&h1c->ibuf)*/)
+ if (ret || !h1c->h1s)
h1_process(h1c);
return NULL;
}