BUG/MINOR: session: Add some forgotten tests on session's listener
During backport of commit 36119de18 ("BUG/MEDIUM: session: NULL dereference
possible when accessing the listener"), I missed some tests on the session's
listener because of the context changes.
It is specific to the 2.3, thus there is no upstream commit ID. It must
backported with the above commit as far as 1.8.
(cherry picked from commit e3f9f2bd9df54a3c05d9e3b21fadc39d771853a9)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit a648a4fc9d485c063ddfd544a056f06c1681052a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 25af0d411fb8af2bef3e763c2a7e7ea9c561194b)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/proto_htx.c b/src/proto_htx.c
index 9ac9ffa..add9a10 100644
--- a/src/proto_htx.c
+++ b/src/proto_htx.c
@@ -150,7 +150,7 @@
stream_inc_http_req_ctr(s);
proxy_inc_fe_req_ctr(sess->fe);
_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
- if (sess->listener->counters)
+ if (sess->listener && sess->listener->counters)
_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
txn->status = 400;
@@ -178,7 +178,7 @@
stream_inc_http_req_ctr(s);
proxy_inc_fe_req_ctr(sess->fe);
_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
- if (sess->listener->counters)
+ if (sess->listener && sess->listener->counters)
_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
txn->status = 408;
@@ -207,7 +207,7 @@
stream_inc_http_req_ctr(s);
proxy_inc_fe_req_ctr(sess->fe);
_HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_req, 1);
- if (sess->listener->counters)
+ if (sess->listener && sess->listener->counters)
_HA_ATOMIC_ADD(&sess->listener->counters->failed_req, 1);
txn->status = 400;
@@ -225,7 +225,7 @@
req->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
s->res.flags &= ~CF_EXPECT_MORE; /* speed up sending a previous response */
- if (sess->listener->options & LI_O_NOQUICKACK && htx_is_not_empty(htx) &&
+ if (sess->listener && (sess->listener->options & LI_O_NOQUICKACK) && htx_is_not_empty(htx) &&
objt_conn(sess->origin) && conn_ctrl_ready(__objt_conn(sess->origin))) {
/* We need more data, we have to re-enable quick-ack in case we
* previously disabled it, otherwise we might cause the client