feat: Close the connection after authentication failed in HTTP API

Improve the safety of HTTP API
This commit is contained in:
xia-chu 2024-05-09 18:07:08 +08:00
parent 8ac957f338
commit 2eed284e61

View File

@ -289,6 +289,8 @@ static inline void addHttpListener(){
it->second(parser, invoker, sender); it->second(parser, invoker, sender);
} catch (ApiRetException &ex) { } catch (ApiRetException &ex) {
responseApi(ex.code(), ex.what(), invoker); responseApi(ex.code(), ex.what(), invoker);
auto helper = static_cast<SocketHelper &>(sender).shared_from_this();
helper->getPoller()->async([helper, ex]() { helper->shutdown(SockException(Err_shutdown, ex.what())); }, false);
} }
#ifdef ENABLE_MYSQL #ifdef ENABLE_MYSQL
catch(SqlException &ex){ catch(SqlException &ex){