Server settings
This section describes setter method of restinio::server_settings_t.
For each method, a type of setter’s argument is specified and a brief
description of a setter is provided.
Traits independent settings
acceptor_options_setter
| Type: | acceptor_options_setter_t |
|---|---|
| Description: | Set an option setter of server’s acceptor (see Acceptor section for more details). |
acceptor_post_bind_hook
| Type: | acceptor_post_bind_hook_t |
|---|---|
| Description: | Set an optional hook that will be called just after the return from
a successful call to bind() for the acceptor. |
address(asio::ip::address)
| Type: | asio::ip::address or boost::asio::ip::address |
|---|---|
| Description: | Address for server endpoint. |
address(std::string)
| Type: | std::string |
|---|---|
| Description: | Address for server endpoint. Can be set to a concrete IP address when running on a machine with two or more network cards. Also supports values localhost, ip6-localhost. |
buffer_size
| Type: | std::size_t |
|---|---|
| Description: | It limits a size of the chunk that can be read from a socket in a single read operation (when receiving HTTP request). |
cleanup_func
| Type: | function-object |
|---|---|
| Description: | Cleanup function. |
concurrent_accepts_count
| Type: | std::size_t |
|---|---|
| Description: | Max number of running concurrent accepts. When running server on N threads then up to N accepts can be handled concurrently. |
handle_request_timeout
| Type: | std::chrono::steady_clock::duration |
|---|---|
| Description: | A period of time that is given for a handler to create any response. |
incoming_http_msg_limits
| Type: |
|
|---|---|
| Description: | A set of limits for controlling the length of various parts of an incoming
HTTP message (like the length of URL or HTTP-field’s name). This is an
optional setting. By default, limits are not using (technically speaking the
limits are sets to the maximum value of A usage example: struct my_traits : public restinio::default_traits_t { ... };
restinio::server_settings_t<my_traits> settings;
settings.incoming_http_msg_limits(
restinio::incoming_http_msg_limits_t{}
.max_url_size(8000u)
.max_field_name_size(2048u)
.max_field_value_size(4096u)
);
...
auto server = restinio::run_async(
restinio::own_io_context(),
std::move(settings),
std::thread::hardware_concurrency());
|
max_pipelined_requests
| Type: | std::size_t |
|---|---|
| Description: | Max pipelined requests able to receive on a single connection. |
port
| Type: | std::uint16_t |
|---|---|
| Description: | Server port to be listened by HTTP server. |
protocol
| Type: | asio::ip::tcp |
|---|---|
| Description: | Protocol ipv4/ipv6 used for server endpoint. |
read_next_http_message_timelimit
| Type: | std::chrono::steady_clock::duration |
|---|---|
| Description: | A period for holding connection before completely receiving new HTTP-request. Starts counting since a connection is established or a previous request was responded. |
separate_accept_and_create_connect
| Type: | bool |
|---|---|
| Description: | For the cases when a lot of connection can be fired by clients in a short time interval, it is vital to accept connections and initiate new accept operations as quick as possible. So creating connection instance that involves allocations and initialization can be done in a context that is independent of acceptors one. |
socket_options_setter
| Type: | socket_options_setter_t |
|---|---|
| Description: | Socket options setter. |
write_http_response_timelimit
| Type: | std::chrono::steady_clock::duration |
|---|---|
| Description: | A period of time to wait for a response to be written to a socket. |
Traits dependent settings
max_parallel_connections
| Type: |
|
|---|---|
| Description: | Sets the maximum allowed count of active parallel connections.
If this parameter is set and that count of parallel connections
reached then RESTinio stops call Note: this method can only be called if A usage example: struct my_traits : public restinio::default_traits_t {
static constexpr bool use_connection_count_limiter = true;
};
...
restinio::server_settings_t<my_traits> settings;
settings.max_parallel_connections(1000u);
...
auto server = restinio::run_async(
restinio::own_io_context(),
std::move(settings),
std::thread::hardware_concurrency());
|
logger
| Type: | Params &&... |
|---|---|
| Description: | Constructs the logger object from the provided params (see logger_t section). |
request_handler
| Type: | std::unique_ptr<typename Traits::request_handler_t> |
|---|---|
| Description: | Sets a request handler. |
timer_manager
| Type: | Params &&... |
|---|---|
| Description: | Constructs the timers manager object from the provided params (see timer_manager_t section). |