From 8ef75340628227748eb95abda751c0235d41b96c Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Tue, 16 May 2023 10:32:55 +0200 Subject: clear partially formatted response if request fails (http asio) (#310) * simplfy error response by dropping partially formatted response * Update CHANGELOG.md --- src/zenhttp/httpasio.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/zenhttp/httpasio.cpp') diff --git a/src/zenhttp/httpasio.cpp b/src/zenhttp/httpasio.cpp index 7149caf28..0056103cd 100644 --- a/src/zenhttp/httpasio.cpp +++ b/src/zenhttp/httpasio.cpp @@ -543,6 +543,9 @@ HttpServerConnection::HandleRequest() { ZEN_ERROR("Caught exception while handling request: '{}'", ex.what()); + // Drop any partially formatted response + Request.m_Response.reset(); + Request.WriteResponse(HttpResponseCode::InternalServerError, HttpContentType::kText, ex.what()); } } -- cgit v1.2.3