From 89d891e133ad8e29b8297a9545a3130a6ebd8458 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Thu, 6 Sep 2018 16:34:29 -0500 Subject: [PATCH] Disable the HttpSM half open logic if the underlying transport is TLS --- proxy/http/Http1ClientSession.h | 7 +++++++ proxy/http/Http1ClientTransaction.cc | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h index decdc9f968f..ce988fda521 100644 --- a/proxy/http/Http1ClientSession.h +++ b/proxy/http/Http1ClientSession.h @@ -76,6 +76,13 @@ class Http1ClientSession : public ProxyClientSession void do_io_shutdown(ShutdownHowTo_t howto) override; void reenable(VIO *vio) override; + bool + allow_half_open() + { + // Only allow half open connections if the not over TLS + return (client_vc && dynamic_cast(client_vc) == nullptr); + } + void set_half_close_flag(bool flag) override { diff --git a/proxy/http/Http1ClientTransaction.cc b/proxy/http/Http1ClientTransaction.cc index 2d4edb07bca..5c5f1759b90 100644 --- a/proxy/http/Http1ClientTransaction.cc +++ b/proxy/http/Http1ClientTransaction.cc @@ -71,5 +71,10 @@ Http1ClientTransaction::transaction_done() bool Http1ClientTransaction::allow_half_open() const { - return current_reader ? current_reader->t_state.txn_conf->allow_half_open > 0 : true; + bool config_allows_it = (current_reader) ? current_reader->t_state.txn_conf->allow_half_open > 0 : true; + if (config_allows_it) { + // Check with the session to make sure the underlying transport allows the half open scenario + return static_cast(parent)->allow_half_open(); + } + return false; }