diff options
author | Michele Papalini <micpapal@cisco.com> | 2023-02-01 17:25:21 +0100 |
---|---|---|
committer | Michele Papalini <micpapal@cisco.com> | 2023-02-02 14:56:22 +0100 |
commit | b96d1545a8d2a173dc5911ed0bca3e04dbb02176 (patch) | |
tree | a69893191b0f7d52c10135e8b0c7702378ffee69 /apps/http-proxy/includes/hicn/http-proxy/http_session.h | |
parent | f72846be51c7fd70310ea166cfc2ffbdc930f0e6 (diff) |
fix(apps): fix issues reported by sonarqube
Ref: HICN-836
Signed-off-by: Michele Papalini <micpapal@cisco.com>
Change-Id: Ie76771ca75bd224084ce3c893aba661b97064419
Diffstat (limited to 'apps/http-proxy/includes/hicn/http-proxy/http_session.h')
-rw-r--r-- | apps/http-proxy/includes/hicn/http-proxy/http_session.h | 24 |
1 files changed, 13 insertions, 11 deletions
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_; |