From 6c9883a084f60199a134a9f98b71f6f5d21cc3e7 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Fri, 19 Jun 2026 16:06:34 -0400 Subject: [PATCH] return a internal server error when a exception is thrown during the read() operation for REST API calls; --- src/common/restapi/http/SecureServerConnection.h | 5 ++++- src/common/restapi/http/ServerConnection.h | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common/restapi/http/SecureServerConnection.h b/src/common/restapi/http/SecureServerConnection.h index 801fdc0e..97c5b14f 100644 --- a/src/common/restapi/http/SecureServerConnection.h +++ b/src/common/restapi/http/SecureServerConnection.h @@ -197,9 +197,12 @@ namespace restapi } } catch(const std::exception& e) { - ::LogError(LOG_REST, "SecureServerConnection::read(), %s", ec.message().c_str()); + ::LogError(LOG_REST, "SecureServerConnection::read(), %s %s", e.what(), ec.message().c_str()); m_continue = false; m_contResult = HTTPLexer::INDETERMINATE; + + m_reply = HTTPPayload::statusPayload(HTTPPayload::INTERNAL_SERVER_ERROR); + write(); } } else if (ec != asio::error::operation_aborted) { diff --git a/src/common/restapi/http/ServerConnection.h b/src/common/restapi/http/ServerConnection.h index 98bbf2bc..df7c2ac1 100644 --- a/src/common/restapi/http/ServerConnection.h +++ b/src/common/restapi/http/ServerConnection.h @@ -180,9 +180,12 @@ namespace restapi } } catch(const std::exception& e) { - ::LogError(LOG_REST, "ServerConnection::read(), %s", ec.message().c_str()); + ::LogError(LOG_REST, "ServerConnection::read(), %s %s", e.what(), ec.message().c_str()); m_continue = false; m_contResult = HTTPLexer::INDETERMINATE; + + m_reply = HTTPPayload::statusPayload(HTTPPayload::INTERNAL_SERVER_ERROR); + write(); } } else if (ec != asio::error::operation_aborted) {