diff --git a/http/server/HttpHandler.cpp b/http/server/HttpHandler.cpp index d93bbb15a..e258a651b 100644 --- a/http/server/HttpHandler.cpp +++ b/http/server/HttpHandler.cpp @@ -296,6 +296,9 @@ void HttpHandler::onHeadersComplete() { } if (status_code != HTTP_STATUS_OK && status_code != HTTP_STATUS_NEXT) { SetError(ERR_REQUEST, static_cast(status_code)); + // NOTE: send the status before receiving the body + keepalive = false; + SendHttpStatusResponse(static_cast(status_code)); return; } }