diff --git a/CMakeLists.txt b/CMakeLists.txt index ae6a2365..0544fbf4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ set(BOOST_HTTP_PROTO_DEPENDENCIES Boost::capy Boost::config Boost::core + Boost::json Boost::mp11 Boost::static_assert Boost::system @@ -122,7 +123,7 @@ if (BOOST_HTTP_PROTO_IS_ROOT) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${BOOST_SRC_DIR}/tools/cmake/include") else () # From Boost Package - find_package(Boost REQUIRED COMPONENTS buffers filesystem url) + find_package(Boost REQUIRED COMPONENTS buffers filesystem json url) foreach (BOOST_INCLUDE_LIBRARY ${BOOST_INCLUDE_LIBRARIES}) if (NOT TARGET Boost::${BOOST_INCLUDE_LIBRARY}) add_library(Boost::${BOOST_INCLUDE_LIBRARY} ALIAS Boost::headers) diff --git a/build/Jamfile b/build/Jamfile index b4898e96..8e688b72 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -41,12 +41,14 @@ lib boost_http_proto : requirements /boost//buffers /boost//capy + /boost/json//boost_json/off /boost//url ../ BOOST_HTTP_PROTO_SOURCE : usage-requirements /boost//buffers /boost//capy + /boost/json//boost_json/off /boost//url ; diff --git a/include/boost/http_proto/json.hpp b/include/boost/http_proto/json.hpp new file mode 100644 index 00000000..50399c89 --- /dev/null +++ b/include/boost/http_proto/json.hpp @@ -0,0 +1,22 @@ +// +// Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/cppalliance/http_proto +// + +#ifndef BOOST_HTTP_PROTO_JSON_HPP +#define BOOST_HTTP_PROTO_JSON_HPP + +#include +#include + +namespace boost { +namespace http_proto { + +} // http_proto +} // boost + +#endif diff --git a/src/server/route_handler.cpp b/src/server/route_handler.cpp index 7e4f92ac..9e60beed 100644 --- a/src/server/route_handler.cpp +++ b/src/server/route_handler.cpp @@ -73,8 +73,9 @@ spawn( return; } auto rv = std::move(std::get<1>(r)); + auto resume_ = resume; // would be destroyed h.destroy(); - resume(rv); + resume_(rv); }; ex.post([h]() { h.resume(); }); diff --git a/test/unit/json.cpp b/test/unit/json.cpp new file mode 100644 index 00000000..1c87c680 --- /dev/null +++ b/test/unit/json.cpp @@ -0,0 +1,11 @@ +// +// Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/cppalliance/http_proto +// + +// Test that header file is self-contained. +#include