RESTinio
incoming_http_msg_limits.hpp
Go to the documentation of this file.
1 /*
2  * RESTinio
3  */
4 
12 #pragma once
13 
15 
16 #include <cstdint>
17 #include <limits>
18 
19 namespace restinio
20 {
21 
22 //
23 // incoming_http_msg_limits_t
24 //
69 {
70  std::size_t m_max_url_size{ std::numeric_limits<std::size_t>::max() };
71  std::size_t m_max_field_name_size{ std::numeric_limits<std::size_t>::max() };
72  std::size_t m_max_field_value_size{ std::numeric_limits<std::size_t>::max() };
73  std::size_t m_max_field_count{ std::numeric_limits<std::size_t>::max() };
74  std::uint64_t m_max_body_size{ std::numeric_limits<std::uint64_t>::max() };
75 
76 public:
77  incoming_http_msg_limits_t() noexcept = default;
78 
80  std::size_t
81  max_url_size() const noexcept { return m_max_url_size; }
82 
84  max_url_size( std::size_t value ) & noexcept
85  {
86  m_max_url_size = value;
87  return *this;
88  }
89 
91  max_url_size( std::size_t value ) && noexcept
92  {
93  return std::move(max_url_size(value));
94  }
95 
97  std::size_t
99 
101  max_field_name_size( std::size_t value ) & noexcept
102  {
103  m_max_field_name_size = value;
104  return *this;
105  }
106 
108  max_field_name_size( std::size_t value ) && noexcept
109  {
110  return std::move(max_field_name_size(value));
111  }
112 
114  std::size_t
116 
118  max_field_value_size( std::size_t value ) & noexcept
119  {
120  m_max_field_value_size = value;
121  return *this;
122  }
123 
125  max_field_value_size( std::size_t value ) && noexcept
126  {
127  return std::move(max_field_value_size(value));
128  }
129 
131  std::size_t
132  max_field_count() const noexcept { return m_max_field_count; }
133 
135  max_field_count( std::size_t value ) & noexcept
136  {
137  m_max_field_count = value;
138  return *this;
139  }
140 
142  max_field_count( std::size_t value ) && noexcept
143  {
144  return std::move(max_field_count(value));
145  }
146 
148  std::uint64_t
149  max_body_size() const noexcept { return m_max_body_size; }
150 
152  max_body_size( std::uint64_t value ) & noexcept
153  {
154  m_max_body_size = value;
155  return *this;
156  }
157 
159  max_body_size( std::uint64_t value ) && noexcept
160  {
161  return std::move(max_body_size(value));
162  }
163 };
164 
165 } /* namespace restinio */
166 
RESTINIO_NODISCARD
#define RESTINIO_NODISCARD
Definition: compiler_features.hpp:33
restinio::incoming_http_msg_limits_t::max_body_size
incoming_http_msg_limits_t & max_body_size(std::uint64_t value) &noexcept
Definition: incoming_http_msg_limits.hpp:152
nonstd::optional_lite::std11::move
T & move(T &t)
Definition: optional.hpp:421
restinio::incoming_http_msg_limits_t::max_field_name_size
incoming_http_msg_limits_t && max_field_name_size(std::size_t value) &&noexcept
Definition: incoming_http_msg_limits.hpp:108
restinio::incoming_http_msg_limits_t::m_max_body_size
std::uint64_t m_max_body_size
Definition: incoming_http_msg_limits.hpp:74
restinio::incoming_http_msg_limits_t::m_max_field_count
std::size_t m_max_field_count
Definition: incoming_http_msg_limits.hpp:73
restinio::incoming_http_msg_limits_t
A type of holder of limits related to an incoming HTTP message.
Definition: incoming_http_msg_limits.hpp:69
restinio::incoming_http_msg_limits_t::max_field_value_size
incoming_http_msg_limits_t && max_field_value_size(std::size_t value) &&noexcept
Definition: incoming_http_msg_limits.hpp:125
restinio::incoming_http_msg_limits_t::max_field_count
incoming_http_msg_limits_t & max_field_count(std::size_t value) &noexcept
Definition: incoming_http_msg_limits.hpp:135
restinio::incoming_http_msg_limits_t::incoming_http_msg_limits_t
incoming_http_msg_limits_t() noexcept=default
restinio::incoming_http_msg_limits_t::max_field_count
incoming_http_msg_limits_t && max_field_count(std::size_t value) &&noexcept
Definition: incoming_http_msg_limits.hpp:142
restinio::incoming_http_msg_limits_t::max_body_size
incoming_http_msg_limits_t && max_body_size(std::uint64_t value) &&noexcept
Definition: incoming_http_msg_limits.hpp:159
restinio::incoming_http_msg_limits_t::max_field_value_size
incoming_http_msg_limits_t & max_field_value_size(std::size_t value) &noexcept
Definition: incoming_http_msg_limits.hpp:118
restinio::incoming_http_msg_limits_t::max_url_size
incoming_http_msg_limits_t && max_url_size(std::size_t value) &&noexcept
Definition: incoming_http_msg_limits.hpp:91
restinio::incoming_http_msg_limits_t::max_field_value_size
RESTINIO_NODISCARD std::size_t max_field_value_size() const noexcept
Definition: incoming_http_msg_limits.hpp:115
restinio::incoming_http_msg_limits_t::max_field_count
RESTINIO_NODISCARD std::size_t max_field_count() const noexcept
Definition: incoming_http_msg_limits.hpp:132
restinio::incoming_http_msg_limits_t::max_url_size
incoming_http_msg_limits_t & max_url_size(std::size_t value) &noexcept
Definition: incoming_http_msg_limits.hpp:84
restinio
Definition: asio_include.hpp:21
restinio::incoming_http_msg_limits_t::m_max_field_value_size
std::size_t m_max_field_value_size
Definition: incoming_http_msg_limits.hpp:72
restinio::incoming_http_msg_limits_t::m_max_url_size
std::size_t m_max_url_size
Definition: incoming_http_msg_limits.hpp:70
restinio::incoming_http_msg_limits_t::max_field_name_size
RESTINIO_NODISCARD std::size_t max_field_name_size() const noexcept
Definition: incoming_http_msg_limits.hpp:98
compiler_features.hpp
Detection of compiler version and absence of various features.
restinio::incoming_http_msg_limits_t::max_url_size
RESTINIO_NODISCARD std::size_t max_url_size() const noexcept
Definition: incoming_http_msg_limits.hpp:81
restinio::incoming_http_msg_limits_t::m_max_field_name_size
std::size_t m_max_field_name_size
Definition: incoming_http_msg_limits.hpp:71
restinio::incoming_http_msg_limits_t::max_body_size
RESTINIO_NODISCARD std::uint64_t max_body_size() const noexcept
Definition: incoming_http_msg_limits.hpp:149
restinio::incoming_http_msg_limits_t::max_field_name_size
incoming_http_msg_limits_t & max_field_name_size(std::size_t value) &noexcept
Definition: incoming_http_msg_limits.hpp:101
const
#define const
Definition: zconf.h:230