| 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/http_proto | ||
| 8 | // | ||
| 9 | |||
| 10 | #include <boost/http_proto/server/router_types.hpp> | ||
| 11 | #include <boost/url/grammar/ci_string.hpp> | ||
| 12 | #include <boost/assert.hpp> | ||
| 13 | #include <cstring> | ||
| 14 | |||
| 15 | namespace boost { | ||
| 16 | namespace http_proto { | ||
| 17 | |||
| 18 | namespace detail { | ||
| 19 | |||
| 20 | const char* | ||
| 21 | ✗ | route_cat_type:: | |
| 22 | name() const noexcept | ||
| 23 | { | ||
| 24 | ✗ | return "boost.http"; | |
| 25 | } | ||
| 26 | |||
| 27 | std::string | ||
| 28 | 294 | route_cat_type:: | |
| 29 | message(int code) const | ||
| 30 | { | ||
| 31 |
1/1✓ Branch 2 taken 294 times.
|
588 | return message(code, nullptr, 0); |
| 32 | } | ||
| 33 | |||
| 34 | char const* | ||
| 35 | 294 | route_cat_type:: | |
| 36 | message( | ||
| 37 | int code, | ||
| 38 | char*, | ||
| 39 | std::size_t) const noexcept | ||
| 40 | { | ||
| 41 |
5/7✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 98 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 188 times.
✗ Branch 6 not taken.
|
294 | switch(static_cast<route>(code)) |
| 42 | { | ||
| 43 | 2 | case route::close: return "route::close"; | |
| 44 | 2 | case route::complete: return "route::complete"; | |
| 45 | 4 | case route::suspend: return "route::suspend"; | |
| 46 | 98 | case route::next: return "route::next"; | |
| 47 | ✗ | case route::next_route: return "route::next_route"; | |
| 48 | 188 | case route::send: return "route::send"; | |
| 49 | ✗ | default: | |
| 50 | ✗ | return "?"; | |
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | // msvc 14.0 has a bug that warns about inability | ||
| 55 | // to use constexpr construction here, even though | ||
| 56 | // there's no constexpr construction | ||
| 57 | #if defined(_MSC_VER) && _MSC_VER <= 1900 | ||
| 58 | # pragma warning( push ) | ||
| 59 | # pragma warning( disable : 4592 ) | ||
| 60 | #endif | ||
| 61 | |||
| 62 | #if defined(__cpp_constinit) && __cpp_constinit >= 201907L | ||
| 63 | constinit route_cat_type route_cat; | ||
| 64 | #else | ||
| 65 | route_cat_type route_cat; | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #if defined(_MSC_VER) && _MSC_VER <= 1900 | ||
| 69 | # pragma warning( pop ) | ||
| 70 | #endif | ||
| 71 | |||
| 72 | } // detail | ||
| 73 | |||
| 74 | resumer | ||
| 75 | ✗ | suspender:: | |
| 76 | owner:: | ||
| 77 | do_suspend() | ||
| 78 | { | ||
| 79 | ✗ | detail::throw_logic_error(); | |
| 80 | } | ||
| 81 | |||
| 82 | bool | ||
| 83 | 3 | route_params_base:: | |
| 84 | is_method( | ||
| 85 | core::string_view s) const noexcept | ||
| 86 | { | ||
| 87 | 3 | auto m = http_proto::string_to_method(s); | |
| 88 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | if(m != http_proto::method::unknown) |
| 89 | 2 | return verb_ == m; | |
| 90 | 1 | return s == verb_str_; | |
| 91 | } | ||
| 92 | |||
| 93 | } // http_proto | ||
| 94 | } // boost | ||
| 95 |