summaryrefslogtreecommitdiffstats
path: root/server/src/http_common.cppm
diff options
context:
space:
mode:
authorRutger Broekhoff2026-11-30 21:27:55 +0100
committerRutger Broekhoff2026-11-30 21:27:55 +0100
commit7bba7176194c4d1d9c7066f8eda7a94491d924e6 (patch)
treea9a171e8608786e09d6342729ee13b8471c0c9c2 /server/src/http_common.cppm
parent02475e05ccd1aa15c6a6163834f28bfebbef796f (diff)
downloadroutemon-7bba7176194c4d1d9c7066f8eda7a94491d924e6.tar.gz
routemon-7bba7176194c4d1d9c7066f8eda7a94491d924e6.zip
Cleanups and updates
Diffstat (limited to 'server/src/http_common.cppm')
-rw-r--r--server/src/http_common.cppm79
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 @@
1module;
2
3#include <boost/beast/core.hpp>
4#include <boost/beast/http.hpp>
5
6export module routemon:http.common;
7
8namespace beast = boost::beast;
9export namespace bhttp = beast::http;
10
11namespace boost::beast {
12
13namespace concepts {
14
15template <class T>
16concept buffers_generator = beast::is_buffers_generator<T>::value;
17
18template <class T>
19concept const_buffer_sequence = beast::is_const_buffer_sequence<T>::value;
20
21} // namespace concepts
22
23namespace http::concepts {
24
25template <class T>
26concept fields = is_fields<T>::value;
27
28template <class T>
29concept body = is_body<T>::value;
30
31template <class T>
32concept body_reader = is_body_reader<T>::value;
33
34} // namespace http::concepts
35
36} // namespace boost::beast
37
38namespace routemon::http {
39
40struct 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
61export 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};
76static_assert(sizeof(verb_set) == 1);
77static_assert(alignof(verb_set) == 1);
78
79} // namespace routemon::http