| 1 |
|
|
1 |
|
|
| 2 |
|
// Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com)
|
2 |
|
// Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com)
|
| 3 |
|
|
3 |
|
|
| 4 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
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)
|
5 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
| 6 |
|
|
6 |
|
|
| 7 |
|
// Official repository: https://github.com/cppalliance/http
|
7 |
|
// Official repository: https://github.com/cppalliance/http
|
| 8 |
|
|
8 |
|
|
| 9 |
|
|
9 |
|
|
| 10 |
|
#ifndef BOOST_HTTP_SERVER_DETAIL_ROUTE_MATCH_HPP
|
10 |
|
#ifndef BOOST_HTTP_SERVER_DETAIL_ROUTE_MATCH_HPP
|
| 11 |
|
#define BOOST_HTTP_SERVER_DETAIL_ROUTE_MATCH_HPP
|
11 |
|
#define BOOST_HTTP_SERVER_DETAIL_ROUTE_MATCH_HPP
|
| 12 |
|
|
12 |
|
|
| 13 |
|
#include <boost/http/detail/config.hpp>
|
13 |
|
#include <boost/http/detail/config.hpp>
|
| 14 |
|
#include <boost/http/server/detail/router_base.hpp>
|
14 |
|
#include <boost/http/server/detail/router_base.hpp>
|
| 15 |
|
#include "src/server/route_abnf.hpp"
|
15 |
|
#include "src/server/route_abnf.hpp"
|
| 16 |
|
#include "src/server/detail/stable_string.hpp"
|
16 |
|
#include "src/server/detail/stable_string.hpp"
|
| 17 |
|
|
17 |
|
|
| 18 |
|
|
18 |
|
|
| 19 |
|
|
19 |
|
|
| 20 |
|
|
20 |
|
|
| 21 |
|
|
21 |
|
|
| 22 |
|
|
22 |
|
|
| 23 |
|
|
23 |
|
|
| 24 |
|
// Matches a path against a pattern
|
24 |
|
// Matches a path against a pattern
|
| 25 |
|
// Members ordered largest-to-smallest for optimal packing
|
25 |
|
// Members ordered largest-to-smallest for optimal packing
|
| 26 |
|
struct detail::router_base::matcher
|
26 |
|
struct detail::router_base::matcher
|
| 27 |
|
|
27 |
|
|
| 28 |
|
matcher(std::string_view pat, bool end_);
|
28 |
|
matcher(std::string_view pat, bool end_);
|
| 29 |
|
|
29 |
|
|
| 30 |
|
|
30 |
|
|
| 31 |
|
|
31 |
|
|
| 32 |
|
|
32 |
|
|
| 33 |
|
|
33 |
|
|
| 34 |
|
|
34 |
|
|
| 35 |
|
// Returns error from pattern parsing, or empty if valid
|
35 |
|
// Returns error from pattern parsing, or empty if valid
|
| 36 |
|
system::error_code error() const noexcept { return ec_; }
|
36 |
|
system::error_code error() const noexcept { return ec_; }
|
| 37 |
|
|
37 |
|
|
| 38 |
|
|
38 |
|
|
| 39 |
|
friend class detail::router_base;
|
39 |
|
friend class detail::router_base;
|
| 40 |
|
friend struct detail::router_base::impl;
|
40 |
|
friend struct detail::router_base::impl;
|
| 41 |
|
|
41 |
|
|
| 42 |
|
|
42 |
|
|
| 43 |
|
std::string allow_header_;
|
43 |
|
std::string allow_header_;
|
| 44 |
|
detail::route_pattern pattern_;
|
44 |
|
detail::route_pattern pattern_;
|
| 45 |
|
std::vector<std::string> custom_verbs_;
|
45 |
|
std::vector<std::string> custom_verbs_;
|
| 46 |
|
|
46 |
|
|
| 47 |
|
// 16 bytes (pointer + size)
|
47 |
|
// 16 bytes (pointer + size)
|
| 48 |
|
detail::stable_string decoded_pat_;
|
48 |
|
detail::stable_string decoded_pat_;
|
| 49 |
|
|
49 |
|
|
| 50 |
|
|
50 |
|
|
| 51 |
|
std::size_t first_entry_ = 0;
|
51 |
|
std::size_t first_entry_ = 0;
|
| 52 |
|
|
52 |
|
|
| 53 |
|
std::uint64_t allowed_methods_ = 0;
|
53 |
|
std::uint64_t allowed_methods_ = 0;
|
| 54 |
|
|
54 |
|
|
| 55 |
|
|
55 |
|
|
| 56 |
|
opt_flags effective_opts_ = 0;
|
56 |
|
opt_flags effective_opts_ = 0;
|
| 57 |
|
opt_flags own_opts_ = 0; // router's opt_flags (for re-parenting during inline)
|
57 |
|
opt_flags own_opts_ = 0; // router's opt_flags (for re-parenting during inline)
|
| 58 |
|
std::uint32_t depth_ = 0;
|
58 |
|
std::uint32_t depth_ = 0;
|
| 59 |
|
|
59 |
|
|
| 60 |
|
|
60 |
|
|
| 61 |
|
bool end_; // false for middleware
|
61 |
|
bool end_; // false for middleware
|
| 62 |
|
|
62 |
|
|
| 63 |
|
|
63 |
|
|
| 64 |
|
|
64 |
|
|
| 65 |
|
|
65 |
|
|
| 66 |
|
|
66 |
|
|
| 67 |
|
|
67 |
|
|
| 68 |
|
|
68 |
|
|