RESTinio
Public Member Functions | Private Attributes | List of all members
restinio::incoming_http_msg_limits_t Class Reference

A type of holder of limits related to an incoming HTTP message. More...

#include <incoming_http_msg_limits.hpp>

Public Member Functions

 incoming_http_msg_limits_t () noexcept=default
 
RESTINIO_NODISCARD std::size_t max_url_size () const noexcept
 
incoming_http_msg_limits_tmax_url_size (std::size_t value) &noexcept
 
incoming_http_msg_limits_t && max_url_size (std::size_t value) &&noexcept
 
RESTINIO_NODISCARD std::size_t max_field_name_size () const noexcept
 
incoming_http_msg_limits_tmax_field_name_size (std::size_t value) &noexcept
 
incoming_http_msg_limits_t && max_field_name_size (std::size_t value) &&noexcept
 
RESTINIO_NODISCARD std::size_t max_field_value_size () const noexcept
 
incoming_http_msg_limits_tmax_field_value_size (std::size_t value) &noexcept
 
incoming_http_msg_limits_t && max_field_value_size (std::size_t value) &&noexcept
 
RESTINIO_NODISCARD std::size_t max_field_count () const noexcept
 
incoming_http_msg_limits_tmax_field_count (std::size_t value) &noexcept
 
incoming_http_msg_limits_t && max_field_count (std::size_t value) &&noexcept
 
RESTINIO_NODISCARD std::uint64_t max_body_size () const noexcept
 
incoming_http_msg_limits_tmax_body_size (std::uint64_t value) &noexcept
 
incoming_http_msg_limits_t && max_body_size (std::uint64_t value) &&noexcept
 

Private Attributes

std::size_t m_max_url_size { std::numeric_limits<std::size_t>::max() }
 
std::size_t m_max_field_name_size { std::numeric_limits<std::size_t>::max() }
 
std::size_t m_max_field_value_size { std::numeric_limits<std::size_t>::max() }
 
std::size_t m_max_field_count { std::numeric_limits<std::size_t>::max() }
 
std::uint64_t m_max_body_size { std::numeric_limits<std::uint64_t>::max() }
 

Detailed Description

A type of holder of limits related to an incoming HTTP message.

Since v.0.6.12 RESTinio supports various limits for incoming HTTP messages. If some part of message (like the length of HTTP field name) exceeds the specified limit then that message will be ignored by RESTinio.

For the compatibility with the previous versions such limits are optional. The default constructor of incoming_http_msg_limits_t sets the limits to the maximum values that cannot be exceeded.

In v.0.6.12 a user has to set appropriate values for limits by his/herself. For example:

restinio::on_this_thread<>()
.port(8080)
.address("localhost")
.incoming_http_msg_limits(
.max_url_size(8000u)
.max_body_size(10240u)
)
.request_handler(...)
);
A type of holder of limits related to an incoming HTTP message.
RESTINIO_NODISCARD std::size_t max_field_name_size() const noexcept
RESTINIO_NODISCARD std::size_t max_url_size() const noexcept
RESTINIO_NODISCARD std::uint64_t max_body_size() const noexcept
RESTINIO_NODISCARD std::size_t max_field_value_size() const noexcept
void run(asio_ns::io_context &ioctx, run_on_this_thread_settings_t< Traits > &&settings)
Helper function for running http server until ctrl+c is hit.
Attention
Setters of incoming_http_msg_limits_t doesn't checks values. It means that it is possible to set 0 as a limit for the length of field name size. That will lead to ignorance of every incoming request.
Note
Almost all limits except the limit for the body size are std::size_t. It means that those limits can have different borders in 32- and 64-bit mode. The limit for the body size is always std::uint64_t.
Since
v.0.6.12

Definition at line 68 of file incoming_http_msg_limits.hpp.

Constructor & Destructor Documentation

◆ incoming_http_msg_limits_t()

restinio::incoming_http_msg_limits_t::incoming_http_msg_limits_t ( )
defaultnoexcept

Member Function Documentation

◆ max_body_size() [1/3]

RESTINIO_NODISCARD std::uint64_t restinio::incoming_http_msg_limits_t::max_body_size ( ) const
inlinenoexcept

Definition at line 149 of file incoming_http_msg_limits.hpp.

◆ max_body_size() [2/3]

incoming_http_msg_limits_t && restinio::incoming_http_msg_limits_t::max_body_size ( std::uint64_t  value) &&
inlinenoexcept

Definition at line 159 of file incoming_http_msg_limits.hpp.

◆ max_body_size() [3/3]

incoming_http_msg_limits_t & restinio::incoming_http_msg_limits_t::max_body_size ( std::uint64_t  value) &
inlinenoexcept

Definition at line 152 of file incoming_http_msg_limits.hpp.

◆ max_field_count() [1/3]

RESTINIO_NODISCARD std::size_t restinio::incoming_http_msg_limits_t::max_field_count ( ) const
inlinenoexcept

Definition at line 132 of file incoming_http_msg_limits.hpp.

◆ max_field_count() [2/3]

incoming_http_msg_limits_t && restinio::incoming_http_msg_limits_t::max_field_count ( std::size_t  value) &&
inlinenoexcept

Definition at line 142 of file incoming_http_msg_limits.hpp.

◆ max_field_count() [3/3]

incoming_http_msg_limits_t & restinio::incoming_http_msg_limits_t::max_field_count ( std::size_t  value) &
inlinenoexcept

Definition at line 135 of file incoming_http_msg_limits.hpp.

◆ max_field_name_size() [1/3]

RESTINIO_NODISCARD std::size_t restinio::incoming_http_msg_limits_t::max_field_name_size ( ) const
inlinenoexcept

Definition at line 98 of file incoming_http_msg_limits.hpp.

◆ max_field_name_size() [2/3]

incoming_http_msg_limits_t && restinio::incoming_http_msg_limits_t::max_field_name_size ( std::size_t  value) &&
inlinenoexcept

Definition at line 108 of file incoming_http_msg_limits.hpp.

◆ max_field_name_size() [3/3]

incoming_http_msg_limits_t & restinio::incoming_http_msg_limits_t::max_field_name_size ( std::size_t  value) &
inlinenoexcept

Definition at line 101 of file incoming_http_msg_limits.hpp.

◆ max_field_value_size() [1/3]

RESTINIO_NODISCARD std::size_t restinio::incoming_http_msg_limits_t::max_field_value_size ( ) const
inlinenoexcept

Definition at line 115 of file incoming_http_msg_limits.hpp.

◆ max_field_value_size() [2/3]

incoming_http_msg_limits_t && restinio::incoming_http_msg_limits_t::max_field_value_size ( std::size_t  value) &&
inlinenoexcept

Definition at line 125 of file incoming_http_msg_limits.hpp.

◆ max_field_value_size() [3/3]

incoming_http_msg_limits_t & restinio::incoming_http_msg_limits_t::max_field_value_size ( std::size_t  value) &
inlinenoexcept

Definition at line 118 of file incoming_http_msg_limits.hpp.

◆ max_url_size() [1/3]

RESTINIO_NODISCARD std::size_t restinio::incoming_http_msg_limits_t::max_url_size ( ) const
inlinenoexcept

Definition at line 81 of file incoming_http_msg_limits.hpp.

◆ max_url_size() [2/3]

incoming_http_msg_limits_t && restinio::incoming_http_msg_limits_t::max_url_size ( std::size_t  value) &&
inlinenoexcept

Definition at line 91 of file incoming_http_msg_limits.hpp.

◆ max_url_size() [3/3]

incoming_http_msg_limits_t & restinio::incoming_http_msg_limits_t::max_url_size ( std::size_t  value) &
inlinenoexcept

Definition at line 84 of file incoming_http_msg_limits.hpp.

Member Data Documentation

◆ m_max_body_size

std::uint64_t restinio::incoming_http_msg_limits_t::m_max_body_size { std::numeric_limits<std::uint64_t>::max() }
private

Definition at line 74 of file incoming_http_msg_limits.hpp.

◆ m_max_field_count

std::size_t restinio::incoming_http_msg_limits_t::m_max_field_count { std::numeric_limits<std::size_t>::max() }
private

Definition at line 73 of file incoming_http_msg_limits.hpp.

◆ m_max_field_name_size

std::size_t restinio::incoming_http_msg_limits_t::m_max_field_name_size { std::numeric_limits<std::size_t>::max() }
private

Definition at line 71 of file incoming_http_msg_limits.hpp.

◆ m_max_field_value_size

std::size_t restinio::incoming_http_msg_limits_t::m_max_field_value_size { std::numeric_limits<std::size_t>::max() }
private

Definition at line 72 of file incoming_http_msg_limits.hpp.

◆ m_max_url_size

std::size_t restinio::incoming_http_msg_limits_t::m_max_url_size { std::numeric_limits<std::size_t>::max() }
private

Definition at line 70 of file incoming_http_msg_limits.hpp.


The documentation for this class was generated from the following file: