From b96d1545a8d2a173dc5911ed0bca3e04dbb02176 Mon Sep 17 00:00:00 2001 From: Michele Papalini Date: Wed, 1 Feb 2023 17:25:21 +0100 Subject: fix(apps): fix issues reported by sonarqube Ref: HICN-836 Signed-off-by: Michele Papalini Change-Id: Ie76771ca75bd224084ce3c893aba661b97064419 --- .../includes/hicn/http-proxy/http_session.h | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'apps/http-proxy/includes/hicn/http-proxy/http_session.h') diff --git a/apps/http-proxy/includes/hicn/http-proxy/http_session.h b/apps/http-proxy/includes/hicn/http-proxy/http_session.h index 1563431dc..1b7df96a6 100644 --- a/apps/http-proxy/includes/hicn/http-proxy/http_session.h +++ b/apps/http-proxy/includes/hicn/http-proxy/http_session.h @@ -73,13 +73,16 @@ class HTTPSession { }; public: - HTTPSession(asio::io_service &io_service, std::string &ip_address, - std::string &port, ContentReceivedCallback receive_callback, - OnConnectionClosed on_reconnect_callback, bool client = false); + HTTPSession(asio::io_service &io_service, const std::string &ip_address, + const std::string &port, + const ContentReceivedCallback &receive_callback, + const OnConnectionClosed &on_reconnect_callback, + bool client = false); HTTPSession(asio::ip::tcp::socket socket, - ContentReceivedCallback receive_callback, - OnConnectionClosed on_reconnect_callback, bool client = true); + const ContentReceivedCallback &receive_callback, + const OnConnectionClosed &on_reconnect_callback, + bool client = true); ~HTTPSession(); @@ -103,7 +106,6 @@ class HTTPSession { bool checkConnected(); - private: void handleRead(const std::error_code &ec, std::size_t length); void tryReconnection(); void startConnectionTimer(); @@ -120,14 +122,14 @@ class HTTPSession { asio::streambuf input_buffer_; bool reverse_; - bool is_reconnection_; - bool data_available_; + bool is_reconnection_ = false; + bool data_available_ = false; - std::size_t content_length_; + std::size_t content_length_ = 0; // Chunked encoding - bool is_last_chunk_; - bool chunked_; + bool is_last_chunk_ = false; + bool chunked_ = false; ContentReceivedCallback receive_callback_; OnConnectionClosed on_connection_closed_callback_; -- cgit 1.2.3-korg