BUG/MEDIUM: mux-h1: Get the session from the H1S when capturing bad messages
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 15 Oct 2020 15:19:46 +0000 (17:19 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 19 Oct 2020 06:41:47 +0000 (08:41 +0200)
It is not guaranteed that the backend connection has an owner. It is set when
the connection is created. But when the connection is moved in a server idle
list, the connection owner is set to NULL and may never be set again. On the
other hand, when a mux is created or when a CS is attached, the session is
always defined. The H1 stream always keep a reference on it when it is
created. Thus, when a bad message is captured we should not rely on the
connection owner to retrieve the session. Instead we should get it from the H1
stream.

(cherry picked from commit db2c17da60e80091615ddbe8d97cb964d1f00ac7)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 9d99d5d06863c9ecb1d59de9f3964c8e3b35c298)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

src/mux_h1.c

index 34a9b49..1582f8f 100644 (file)
@@ -1087,7 +1087,7 @@ static void h1_show_error_snapshot(struct buffer *out, const struct error_snapsh
 static void h1_capture_bad_message(struct h1c *h1c, struct h1s *h1s,
                                   struct h1m *h1m, struct buffer *buf)
 {
-       struct session *sess = h1c->conn->owner;
+       struct session *sess = h1s->sess;
        struct proxy *proxy = h1c->px;
        struct proxy *other_end = sess->fe;
        union error_snapshot_ctx ctx;