From fd3da82dd7772419c01bb751e5b5cb7f198b4752 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Thu, 26 Jan 2023 19:14:05 +0100 Subject: websocket bugfix: socket leak --- error.cpp | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 error.cpp (limited to 'error.cpp') diff --git a/error.cpp b/error.cpp deleted file mode 100644 index d7a26de..0000000 --- a/error.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "error.h" - -#include - -#include - -// Report a failure -void fail(boost::beast::error_code ec, char const* what) -{ - // ssl::error::stream_truncated, also known as an SSL "short read", - // indicates the peer closed the connection without performing the - // required closing handshake (for example, Google does this to - // improve performance). Generally this can be a security issue, - // but if your communication protocol is self-terminated (as - // it is with both HTTP and WebSocket) then you may simply - // ignore the lack of close_notify. - // - // https://github.com/boostorg/beast/issues/38 - // - // https://security.stackexchange.com/questions/91435/how-to-handle-a-malicious-ssl-tls-shutdown - // - // When a short read would cut off the end of an HTTP message, - // Beast returns the error beast::http::error::partial_message. - // Therefore, if we see a short read here, it has occurred - // after the message has been completed, so it is safe to ignore it. - - if (ec == boost::asio::ssl::error::stream_truncated) - return; - - std::cerr << what << ": " << ec.message() << "\n"; -} - -- cgit v1.2.3