diff options
| author | Rutger Broekhoff | 2026-11-30 21:27:55 +0100 |
|---|---|---|
| committer | Rutger Broekhoff | 2026-11-30 21:27:55 +0100 |
| commit | 7bba7176194c4d1d9c7066f8eda7a94491d924e6 (patch) | |
| tree | a9a171e8608786e09d6342729ee13b8471c0c9c2 /server/src/http_common.cppm | |
| parent | 02475e05ccd1aa15c6a6163834f28bfebbef796f (diff) | |
| download | routemon-7bba7176194c4d1d9c7066f8eda7a94491d924e6.tar.gz routemon-7bba7176194c4d1d9c7066f8eda7a94491d924e6.zip | |
Cleanups and updates
Diffstat (limited to 'server/src/http_common.cppm')
| -rw-r--r-- | server/src/http_common.cppm | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/server/src/http_common.cppm b/server/src/http_common.cppm deleted file mode 100644 index f56c92b..0000000 --- a/server/src/http_common.cppm +++ /dev/null | |||
| @@ -1,79 +0,0 @@ | |||
| 1 | module; | ||
| 2 | |||
| 3 | #include <boost/beast/core.hpp> | ||
| 4 | #include <boost/beast/http.hpp> | ||
| 5 | |||
| 6 | export module routemon:http.common; | ||
| 7 | |||
| 8 | namespace beast = boost::beast; | ||
| 9 | export namespace bhttp = beast::http; | ||
| 10 | |||
| 11 | namespace boost::beast { | ||
| 12 | |||
| 13 | namespace concepts { | ||
| 14 | |||
| 15 | template <class T> | ||
| 16 | concept buffers_generator = beast::is_buffers_generator<T>::value; | ||
| 17 | |||
| 18 | template <class T> | ||
| 19 | concept const_buffer_sequence = beast::is_const_buffer_sequence<T>::value; | ||
| 20 | |||
| 21 | } // namespace concepts | ||
| 22 | |||
| 23 | namespace http::concepts { | ||
| 24 | |||
| 25 | template <class T> | ||
| 26 | concept fields = is_fields<T>::value; | ||
| 27 | |||
| 28 | template <class T> | ||
| 29 | concept body = is_body<T>::value; | ||
| 30 | |||
| 31 | template <class T> | ||
| 32 | concept body_reader = is_body_reader<T>::value; | ||
| 33 | |||
| 34 | } // namespace http::concepts | ||
| 35 | |||
| 36 | } // namespace boost::beast | ||
| 37 | |||
| 38 | namespace routemon::http { | ||
| 39 | |||
| 40 | struct supported_verb | ||
| 41 | { | ||
| 42 | enum supported_verb_t : std::uint8_t | ||
| 43 | { | ||
| 44 | options, | ||
| 45 | delete_, | ||
| 46 | get, | ||
| 47 | head, | ||
| 48 | post, | ||
| 49 | put, | ||
| 50 | }; | ||
| 51 | |||
| 52 | supported_verb_t value; | ||
| 53 | |||
| 54 | supported_verb(supported_verb_t value); | ||
| 55 | |||
| 56 | static auto from(bhttp::verb v) -> std::optional<supported_verb>; | ||
| 57 | |||
| 58 | operator bhttp::verb() const; | ||
| 59 | }; | ||
| 60 | |||
| 61 | export struct verb_set | ||
| 62 | { | ||
| 63 | bool options : 1 = false; | ||
| 64 | bool delete_ : 1 = false; | ||
| 65 | bool get : 1 = false; | ||
| 66 | bool head : 1 = false; | ||
| 67 | bool post : 1 = false; | ||
| 68 | bool put : 1 = false; | ||
| 69 | |||
| 70 | [[nodiscard]] auto with(supported_verb v) const noexcept -> verb_set; | ||
| 71 | [[nodiscard]] auto empty() const noexcept -> bool; | ||
| 72 | [[nodiscard]] auto to_string() const -> std::string; | ||
| 73 | |||
| 74 | auto operator==(verb_set const& rhs) const noexcept -> bool = default; | ||
| 75 | }; | ||
| 76 | static_assert(sizeof(verb_set) == 1); | ||
| 77 | static_assert(alignof(verb_set) == 1); | ||
| 78 | |||
| 79 | } // namespace routemon::http | ||