From 2eed284e617c7833cf648474a3ac2ba2864a47f5 Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Thu, 9 May 2024 18:07:08 +0800 Subject: [PATCH] feat: Close the connection after authentication failed in HTTP API Improve the safety of HTTP API --- server/WebApi.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 8ea758f3..30a6c559 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -289,6 +289,8 @@ static inline void addHttpListener(){ it->second(parser, invoker, sender); } catch (ApiRetException &ex) { responseApi(ex.code(), ex.what(), invoker); + auto helper = static_cast(sender).shared_from_this(); + helper->getPoller()->async([helper, ex]() { helper->shutdown(SockException(Err_shutdown, ex.what())); }, false); } #ifdef ENABLE_MYSQL catch(SqlException &ex){