From f830a35df83f84e65e91b0ee6555dbed9adc4614 Mon Sep 17 00:00:00 2001 From: an-tao Date: Tue, 10 Nov 2026 14:07:36 +0800 Subject: [PATCH 1/4] Fix HttpFileExceptionSafety race on global upload path Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- lib/tests/unittests/HttpFileTest.cc | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/lib/tests/unittests/HttpFileTest.cc b/lib/tests/unittests/HttpFileTest.cc index 0d2d44d114..198fb98f4b 100644 --- a/lib/tests/unittests/HttpFileTest.cc +++ b/lib/tests/unittests/HttpFileTest.cc @@ -1,6 +1,7 @@ #include "../../lib/src/HttpFileImpl.h" #include #include +#include #include #include #if !defined(_WIN32) @@ -147,27 +148,16 @@ DROGON_TEST(HttpFileExceptionSafety) { // Normal relative paths (not starting with "." or "..") must resolve // against the configured upload directory (app().getUploadPath()). - struct UploadPathGuard - { - std::string originalPath_{drogon::app().getUploadPath()}; - - ~UploadPathGuard() - { - drogon::app().setUploadPath(originalPath_); - } - } guard; - - auto customUploadDir = - filesystem::current_path() / "test_custom_uploads"; - filesystem::create_directories(customUploadDir); - drogon::app().setUploadPath(customUploadDir.string()); + const auto subdir = "test_relative_upload_" + utils::getUuid(); + const auto customUploadDir = + filesystem::path(drogon::app().getUploadPath()) / subdir; HttpFileImpl file; file.setFileName("normal_rel.txt"); file.setFile("test", 4); - int res = file.save("custom_sub"); + int res = file.save(subdir); CHECK(res == 0); - auto expectedPath = customUploadDir / "custom_sub" / "normal_rel.txt"; + auto expectedPath = customUploadDir / "normal_rel.txt"; CHECK(filesystem::exists(expectedPath)); filesystem::remove_all(customUploadDir); From 5b90bab3f066194102e1dfd07b0be27871a87c84 Mon Sep 17 00:00:00 2001 From: an-tao Date: Tue, 10 Nov 2026 14:11:26 +0800 Subject: [PATCH 2/4] Drop unsupported macos-14 from CI matrix Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6fb486e22b..c99e255ded 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -70,7 +70,7 @@ jobs: strategy: fail-fast: false matrix: - osver: [14, 15] + osver: [15] steps: - name: Checkout Drogon source code uses: actions/checkout@v4 From e5716b85060975beca633dc20f3afc4003a1216f Mon Sep 17 00:00:00 2001 From: an-tao Date: Tue, 10 Nov 2026 15:25:33 +0800 Subject: [PATCH 3/4] Copy TLS certs next to cookie_same_site test binary Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- lib/tests/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/tests/CMakeLists.txt b/lib/tests/CMakeLists.txt index b0db32140d..fa519f25d8 100644 --- a/lib/tests/CMakeLists.txt +++ b/lib/tests/CMakeLists.txt @@ -154,6 +154,14 @@ set(COOKIE_SAME_SITE CookieSameSite.cc ) add_executable(cookie_same_site ${COOKIE_SAME_SITE}) +add_custom_command( + TARGET cookie_same_site POST_BUILD + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different + ${PROJECT_SOURCE_DIR}/trantor/trantor/tests/server.crt + ${PROJECT_SOURCE_DIR}/trantor/trantor/tests/server.key + $) add_executable(real_ip_resolver RealIpResolverTest.cc) From 8fe0439bd118615a7905bd7cdc069cbd209cc18d Mon Sep 17 00:00:00 2001 From: an-tao Date: Tue, 10 Nov 2026 16:34:43 +0800 Subject: [PATCH 4/4] Copy TLS certs to the ctest working directory for cookie_same_site Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- lib/tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tests/CMakeLists.txt b/lib/tests/CMakeLists.txt index fa519f25d8..c5f713e082 100644 --- a/lib/tests/CMakeLists.txt +++ b/lib/tests/CMakeLists.txt @@ -161,7 +161,7 @@ add_custom_command( copy_if_different ${PROJECT_SOURCE_DIR}/trantor/trantor/tests/server.crt ${PROJECT_SOURCE_DIR}/trantor/trantor/tests/server.key - $) + ${CMAKE_CURRENT_BINARY_DIR}) add_executable(real_ip_resolver RealIpResolverTest.cc)