src/server/statuses.cpp

100.0% Lines (18/18) 100.0% List of functions (3/3)
statuses.cpp
f(x) Functions (3)
Line TLA Hits Source Code
1 //
2 // Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.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
8 //
9
10 #include <boost/http/server/statuses.hpp>
11
12 namespace boost {
13 namespace http {
14 namespace statuses {
15
16 bool
17 6x is_empty( unsigned code ) noexcept
18 {
19 6x switch( code )
20 {
21 3x case 204: // No Content
22 case 205: // Reset Content
23 case 304: // Not Modified
24 3x return true;
25 3x default:
26 3x return false;
27 }
28 }
29
30 bool
31 9x is_redirect( unsigned code ) noexcept
32 {
33 9x switch( code )
34 {
35 6x case 300: // Multiple Choices
36 case 301: // Moved Permanently
37 case 302: // Found
38 case 303: // See Other
39 case 305: // Use Proxy
40 case 307: // Temporary Redirect
41 case 308: // Permanent Redirect
42 6x return true;
43 3x default:
44 3x return false;
45 }
46 }
47
48 bool
49 6x is_retry( unsigned code ) noexcept
50 {
51 6x switch( code )
52 {
53 3x case 502: // Bad Gateway
54 case 503: // Service Unavailable
55 case 504: // Gateway Timeout
56 3x return true;
57 3x default:
58 3x return false;
59 }
60 }
61
62 } // statuses
63 } // http
64 } // boost
65