From d3664f54303b6e36beb909682bb7fee8e742cfcc Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Wed, 9 Apr 2025 14:57:21 -0400 Subject: [PATCH] http: check if version is known on cleanup peer might close/reset cleartext connection before send something or nothing and connection time-out, in this case do not call http vfts Type: fix Change-Id: Ie30217fb8c68bf96a8d498bb0d50c8b20eb0e370 Signed-off-by: Matus Fabian --- src/plugins/http/http.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c index 321f0017f92..f1590799a05 100644 --- a/src/plugins/http/http.c +++ b/src/plugins/http/http.c @@ -405,7 +405,9 @@ http_conn_timeout_cb (void *hc_handlep) return; } - http_vfts[hc->version].transport_close_callback (hc); + /* in case nothing received on cleartext connection before timeout */ + if (PREDICT_FALSE (hc->version != HTTP_VERSION_NA)) + http_vfts[hc->version].transport_close_callback (hc); http_disconnect_transport (hc); } @@ -561,7 +563,9 @@ http_ts_reset_callback (session_t *ts) hc = http_conn_get_w_thread (hc_handle.conn_index, ts->thread_index); hc->state = HTTP_CONN_STATE_CLOSED; - http_vfts[hc->version].transport_reset_callback (hc); + /* in case peer reset cleartext connection before send something */ + if (PREDICT_FALSE (hc->version != HTTP_VERSION_NA)) + http_vfts[hc->version].transport_reset_callback (hc); http_disconnect_transport (hc); } @@ -671,7 +675,9 @@ http_ts_cleanup_callback (session_t *ts, session_cleanup_ntf_t ntf) if (!(hc->flags & HTTP_CONN_F_PENDING_TIMER)) http_conn_timer_stop (hc); - http_vfts[hc->version].conn_cleanup_callback (hc); + /* in case nothing received on cleartext connection */ + if (PREDICT_FALSE (hc->version != HTTP_VERSION_NA)) + http_vfts[hc->version].conn_cleanup_callback (hc); if (!(hc->flags & HTTP_CONN_F_IS_SERVER)) { -- 2.16.6