From 82c2af5878bb4c695a48c2d0707dffdb9356fce3 Mon Sep 17 00:00:00 2001 From: cflip Date: Thu, 7 Jul 2022 12:06:33 -0600 Subject: Add some more abstractions to HttpResponse --- src/ClientConnection.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/ClientConnection.cpp') diff --git a/src/ClientConnection.cpp b/src/ClientConnection.cpp index 3bf93c3..da0cf9f 100644 --- a/src/ClientConnection.cpp +++ b/src/ClientConnection.cpp @@ -26,24 +26,19 @@ void ClientConnection::dump_request_data() } } -bool ClientConnection::send(const HttpResponse& response, const char* message) +bool ClientConnection::send(const HttpResponse& response) { if (!m_is_open) return false; - std::stringstream ss; - ss << response.to_string() - << "\r\n\r\n" - << message; - - std::string result = ss.str(); + std::string result = response.to_string(); write(m_socket_fd, result.c_str(), result.length()); return true; } -void ClientConnection::close() +void ClientConnection::close_connection() { m_is_open = false; - ::close(m_socket_fd); + close(m_socket_fd); } -- cgit v1.2.3