From 5d7f154a77eb2cf82b6e4e49d20687c8ed839113 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 11 Oct 2017 09:01:35 -0400 Subject: [PATCH] rgw: ask beast parser about keepalive/close Signed-off-by: Casey Bodley --- src/rgw/rgw_asio_client.cc | 8 ++------ src/rgw/rgw_asio_client.h | 2 -- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/rgw/rgw_asio_client.cc b/src/rgw/rgw_asio_client.cc index d0174c9bbbf..46fe0c0c67d 100644 --- a/src/rgw/rgw_asio_client.cc +++ b/src/rgw/rgw_asio_client.cc @@ -39,10 +39,6 @@ void ClientIO::init_env(CephContext *cct) env.set("CONTENT_TYPE", value); continue; } - if (field == beast::http::field::connection) { - conn_keepalive = boost::algorithm::iequals(value, "keep-alive"); - conn_close = boost::algorithm::iequals(value, "close"); - } static const boost::string_ref HTTP_{"HTTP_"}; @@ -175,10 +171,10 @@ size_t ClientIO::complete_header() sent += txbuf.sputn(timestr, strlen(timestr)); } - if (conn_keepalive) { + if (parser.is_keep_alive()) { constexpr char CONN_KEEP_ALIVE[] = "Connection: Keep-Alive\r\n"; sent += txbuf.sputn(CONN_KEEP_ALIVE, sizeof(CONN_KEEP_ALIVE) - 1); - } else if (conn_close) { + } else { constexpr char CONN_KEEP_CLOSE[] = "Connection: close\r\n"; sent += txbuf.sputn(CONN_KEEP_CLOSE, sizeof(CONN_KEEP_CLOSE) - 1); } diff --git a/src/rgw/rgw_asio_client.h b/src/rgw/rgw_asio_client.h index f193e17c496..038be51411c 100644 --- a/src/rgw/rgw_asio_client.h +++ b/src/rgw/rgw_asio_client.h @@ -24,8 +24,6 @@ class ClientIO : public io::RestfulClient, parser_type& parser; beast::flat_buffer& buffer; //< parse buffer - bool conn_keepalive{false}; - bool conn_close{false}; RGWEnv env; rgw::io::StaticOutputBufferer<> txbuf; -- 2.47.3