From d0bd4afb0becfff18145eeefa70318ec948f8bc1 Mon Sep 17 00:00:00 2001 From: Jeremie Rahm Date: Fri, 18 Dec 2020 16:29:36 -0800 Subject: [PATCH] Ensure socket is closed after processing in SSLServer (#804) --- httplib.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/httplib.h b/httplib.h index 656013f..092940e 100644 --- a/httplib.h +++ b/httplib.h @@ -6301,8 +6301,9 @@ inline bool SSLServer::process_and_close_socket(socket_t sock) { }, [](SSL * /*ssl*/) { return true; }); + bool ret = false; if (ssl) { - auto ret = detail::process_server_socket_ssl( + ret = detail::process_server_socket_ssl( ssl, sock, keep_alive_max_count_, keep_alive_timeout_sec_, read_timeout_sec_, read_timeout_usec_, write_timeout_sec_, write_timeout_usec_, @@ -6316,12 +6317,11 @@ inline bool SSLServer::process_and_close_socket(socket_t sock) { // the connection appeared to be closed. const bool shutdown_gracefully = ret; detail::ssl_delete(ctx_mutex_, ssl, shutdown_gracefully); - return ret; } detail::shutdown_socket(sock); detail::close_socket(sock); - return false; + return ret; } // SSL HTTP client implementation