| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com) | ||
| 3 | // | ||
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
| 6 | // | ||
| 7 | // Official repository: https://github.com/cppalliance/beast2 | ||
| 8 | // | ||
| 9 | |||
| 10 | #ifndef BOOST_BEAST2_SERVER_ROUTE_HANDLER_ASIO_HPP | ||
| 11 | #define BOOST_BEAST2_SERVER_ROUTE_HANDLER_ASIO_HPP | ||
| 12 | |||
| 13 | #include <boost/beast2/detail/config.hpp> | ||
| 14 | #include <boost/http_proto/server/route_handler.hpp> | ||
| 15 | #include <type_traits> | ||
| 16 | |||
| 17 | namespace boost { | ||
| 18 | namespace beast2 { | ||
| 19 | |||
| 20 | /** Route parameters object for Asio HTTP route handlers | ||
| 21 | */ | ||
| 22 | template<class AsyncStream> | ||
| 23 | class asio_route_params | ||
| 24 | : public http::route_params | ||
| 25 | { | ||
| 26 | public: | ||
| 27 | using stream_type = typename std::decay<AsyncStream>::type; | ||
| 28 | |||
| 29 | AsyncStream stream; | ||
| 30 | |||
| 31 | template<class... Args> | ||
| 32 | explicit | ||
| 33 | 1 | asio_route_params( | |
| 34 | Args&&... args) | ||
| 35 | 1 | : stream(std::forward<Args>(args)...) | |
| 36 | { | ||
| 37 | 1 | } | |
| 38 | |||
| 39 | private: | ||
| 40 | public: | ||
| 41 | // VFALCO This needs to be private | ||
| 42 | ✗ | void do_finish() | |
| 43 | { | ||
| 44 | ✗ | if(finish_) | |
| 45 | { | ||
| 46 | ✗ | auto f = std::move(finish_); | |
| 47 | ✗ | finish_ = {}; | |
| 48 | ✗ | f(); | |
| 49 | ✗ | } | |
| 50 | ✗ | } | |
| 51 | |||
| 52 | }; | ||
| 53 | |||
| 54 | } // beast2 | ||
| 55 | } // boost | ||
| 56 | |||
| 57 | #endif | ||
| 58 |