From 5256ab94de1b8b4a6e0f7d11dd0f83b3eadbf7d6 Mon Sep 17 00:00:00 2001 From: luocai <168062547@qq.com> Date: Mon, 6 May 2024 16:54:34 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0unraid=E5=8F=8D=E5=90=91?= =?UTF-8?q?=E4=BB=A3=E7=90=86body=E6=9C=80=E5=A4=A7=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/HttpSession.cpp | 8 +++++++- Server/conf/nginx.conf | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Server/HttpSession.cpp b/Server/HttpSession.cpp index 6b8f134..c6c4c53 100644 --- a/Server/HttpSession.cpp +++ b/Server/HttpSession.cpp @@ -1,6 +1,7 @@ #include "HttpSession.h" #include "Application.h" #include +#include #include #include #include @@ -72,7 +73,12 @@ void HttpSession::onRead(boost::beast::error_code ec, std::size_t) { boost::urls::matches matches; auto handler = application->find(*path, matches); if (handler) { - (*handler)(*this, request, matches); + try { + (*handler)(*this, request, matches); + } catch (const std::exception &e) { + boost::stacktrace::stacktrace trace = boost::stacktrace::stacktrace::from_current_exception(); + LOG(error) << e.what() << ", trace:\n" << trace; + } } else { std::ostringstream oss; oss << "The resource '" << request.target() << "' was not found."; diff --git a/Server/conf/nginx.conf b/Server/conf/nginx.conf index 029cf09..8f5617e 100644 --- a/Server/conf/nginx.conf +++ b/Server/conf/nginx.conf @@ -65,7 +65,8 @@ http { server_name unraid.amass.fun; client_header_timeout 120s; - client_body_timeout 120s; + client_body_timeout 120s; + client_max_body_size 512m; #上传文件最大支持512m ssl_certificate cert/unraid.amass.fun.pem; ssl_certificate_key cert/unraid.amass.fun.key;