Loading...
Searching...
No Matches
restinio Namespace Reference

## Namespaces

namespace | asio_ec
namespace | connection_count_limits
namespace | connection_state
namespace | details
namespace | easy_parser
namespace | file_upload
namespace | fmtlib_tools
namespace | http_field_parsers
namespace | impl
namespace | ip_blocker
namespace | multipart_body
namespace | parse_query_traits
namespace | path2regex
namespace | router
namespace | so5
namespace | static_if_details
namespace | status_code
namespace | string_algo
namespace | sync_chain
namespace | transforms
namespace | utils
namespace | websocket

## Classes

class | acceptor_options_t
| An adapter for setting acceptor options before running server. More...
class | asio_timer_manager_t
| Timer factory implementation using asio timers. More...
class | base_response_builder_t
class | basic_server_settings_t
| Basic container for http_server settings. More...
class | chunk_info_t
| Information about one chunk in an incoming request with chunked encoding. More...
class | chunked_input_info_t
| An information about chunks and trailing fields in the incoming request. More...
struct | chunked_output_t
| Tag type for chunked output response builder. More...
struct | connection_count_limit_types
| A kind of metafunction that deduces actual types related to connection count limiter in the dependecy of Traits. More...
struct | connection_state_listener_holder_t
| A special class for holding actual connection state listener. More...
struct | connection_state_listener_holder_t< connection_state::noop_listener_t >
| A special class for case when no-op state listener is used. More...
struct | const_buffer_t
| Helper class for setting a constant buffer storage explicitly. More...
class | default_http_methods_t
| The default implementation for http_method_mapper. More...
class | exception_t
| Exception class for all exceptions thrown by RESTinio. More...
class | extra_data_buffer_t
| Helper for holding a pointer to a buffer where a new object of type Extra_Data should be constructed. More...
class | file_descriptor_holder_t
| Wrapper class for working with native file handler. More...
class | file_meta_t
| Meta data of the file. More...
class | generic_request_t
| HTTP Request data. More...
struct | http_header_common_t
| Req/Resp headers common data. More...
class | http_header_field_t
| A single header field. More...
class | http_header_fields_t
| Header fields map. More...
class | http_method_id_t
| A type for representation of HTTP method ID. More...
struct | http_request_header_t
| Req header. More...
struct | http_response_header_t
| Resp header. More...
class | http_server_t
| Class for http-server. More...
class | http_status_code_t
| A handy wrapper for HTTP response status code. More...
class | http_status_line_t
| HTTP response header status line. More...
class | incoming_http_msg_limits_t
| A type of holder of limits related to an incoming HTTP message. More...
class | io_context_holder_t
| Helper class for holding shared pointer to io_context. More...
struct | ip_blocker_holder_t
| A special class for holding actual IP-blocker object. More...
struct | ip_blocker_holder_t< ip_blocker::noop_ip_blocker_t >
| A special class for case when no-op IP-blocker is used. More...
struct | no_extra_data_factory_t
| The default extra-data-factory to be used in server's traits if a user doesn't specify own one. More...
class | null_logger_t
| No operation logger. More...
struct | null_mutex_t
| A class to be used as null_mutex. More...
struct | null_timer_manager_t
| Timer factory implementation using asio timers. More...
class | on_pool_runner_t
| Helper class for running an existing HTTP-server on a thread pool without blocking the current thread. More...
class | ostream_logger_t
| Logger for std::ostream. More...
class | parse_query_failure_t
| Type that indicates a failure of an attempt of query-string parsing. More...
class | query_string_params_t
| Parameters container for query strings parameters. More...
class | response_builder_t
| Forbid arbitrary response_builder_t instantiations. More...
class | response_builder_t< chunked_output_t >
| Chunked transfer encoding output builder. More...
class | response_builder_t< restinio_controlled_output_t >
| Simple standard response builder. More...
class | response_builder_t< user_controlled_output_t >
| User controlled response output builder. More...
struct | response_output_flags_t
| Response output flags for buffers commited to response-coordinator. More...
struct | restinio_controlled_output_t
| Tag type for RESTinio controlled output response builder. More...
class | run_existing_server_on_thread_pool_t
| Helper type for holding parameters necessary for running HTTP-server on a thread pool. More...
class | run_on_this_thread_settings_t
| Settings for the case when http_server must be run on the context of the current thread. More...
class | run_on_thread_pool_settings_t
| Settings for the case when http_server must be run on the context of the current thread. More...
class | running_server_instance_t
| A helper class used in an implementation of run_async function. More...
class | sendfile_chunk_size_guarded_value_t
| A guard class for setting chunk size. More...
class | sendfile_t
| Send file write operation description. More...
class | server_settings_t
| A fluent style interface for setting http server params. More...
struct | simple_extra_data_factory_t
| A helper template class for cases when extra-data-factory is just a simple stateless object. More...
class | socket_options_t
| An adapter for setting acceptor options before running server. More...
class | socket_type_dependent_settings_t
| Extra settings needed for working with socket. More...
class | socket_type_dependent_settings_t< Settings, tls_socket_t >
| Customizes extra settings needed for working with socket. More...
class | tcp_connection_ctx_base_t
| TCP connection base. More...
struct | traits_t
struct | user_controlled_output_t
| Tag type for user controlled output response builder. More...
class | writable_item_t
| Class for storing the buffers used for streaming body (request/response). More...
class | write_group_t
| Group of writable items transported to the context of underlying connection as one solid piece. More...

## Typedefs

using | error_category_base_t = asio_ns::error_category
| An alias for base class of error category entity.
using | default_asio_executor = asio_ns::executor
using | fmt_minimal_memory_buffer_t = fmt::basic_memory_buffer< char, 1u >
| An alias for fmt::basic_memory_buffer<char,1>.
using | writable_items_container_t = std::vector< writable_item_t >
using | write_status_cb_t = std::function< void(const asio_ns::error_code &ec) >
| An alias for a callback to be invoked after the write operation of a particular group of "buffers".
using | chunked_input_info_unique_ptr_t = std::unique_ptr< chunked_input_info_t >
| Alias of unique_ptr for chunked_input_info.
using | request_id_t = unsigned int
| Request id in scope of single connection.
template<typename T >
using | nullable_pointer_t = T *
| Type for pointer that can be nullptr.
template<typename T >
using | not_null_pointer_t = T *
| Type for pointer that is not null by design.
using | connection_id_t = std::uint64_t
| Type for ID of connection.
using | endpoint_t = asio_ns::ip::tcp::endpoint
| An alias for endpoint type from Asio.
using | default_strand_t = asio_ns::strand< default_asio_executor >
| A typedef for the default strand type.
using | noop_strand_t = default_asio_executor
| A typedef for no-op strand type.
template<typename T , typename E >
using | expected_t = nonstd::expected< T, E >
using | http_field = http_field_t
| Helper alies to omitt `_t` suffix.
using | io_context_shared_ptr_t = std::shared_ptr< asio_ns::io_context >
template<typename Traits >
using | running_server_handle_t = std::unique_ptr< running_server_instance_t< http_server_t< Traits > > >
| The type to be used as a handle for running server instance.
template<class T >
using | optional_t = nonstd::optional< T >
using | single_threaded_ostream_logger_t = ostream_logger_t< null_mutex_t >
using | shared_ostream_logger_t = ostream_logger_t< std::mutex >
template<typename Extra_Data >
using | generic_request_handle_t = std::shared_ptr< generic_request_t< Extra_Data > >
| An alias for shared-pointer to incoming request.
using | request_t = generic_request_t< no_extra_data_factory_t::data_t >
| An alias for incoming request without additional extra-data.
using | request_handle_t = std::shared_ptr< request_t >
| An alias for handle for incoming request without additional extra-data.
using | default_request_handler_t = std::function< request_handling_status_t(request_handle_t) >
using | acceptor_options_setter_t = std::function< void(acceptor_options_t &) >
using | socket_options_setter_t = std::function< void(socket_options_t &) >
using | cleanup_functor_t = std::function< void(void) >
| Type of holder for user's cleanup function.
using | acceptor_post_bind_hook_t = std::function< void(asio_ns::ip::tcp::acceptor &) >
| A type of callback to be called after a successful invocation of bind() function for the acceptor.
using | string_view_t = nonstd::string_view
using | tcp_connection_ctx_handle_t = std::shared_ptr< tcp_connection_ctx_base_t >
| Alias for http connection handle.
using | tcp_connection_ctx_weak_handle_t = std::weak_ptr< tcp_connection_ctx_base_t >
| Alias for http connection weak handle.
using | timer_invocation_tag_t = std::uint32_t
| An invokation tag, for controlling no more actual timers in corner cases.
using | timer_invocation_cb_t = std::add_pointer< void(timer_invocation_tag_t, tcp_connection_ctx_weak_handle_t) >::type
| A pointer to invocation callback for a specific context object.
template<typename Timer_Factory , typename Logger , typename Request_Handler = default_request_handler_t, typename Strand = asio_ns::strand< default_asio_executor >>
using | tls_traits_t = traits_t< Timer_Factory, Logger, Request_Handler, Strand, tls_socket_t >
template<typename Timer_Factory , typename Logger , typename Request_Handler = default_request_handler_t>
using | single_thread_tls_traits_t = tls_traits_t< Timer_Factory, Logger, Request_Handler, noop_strand_t >
using | default_tls_traits_t = tls_traits_t< asio_timer_manager_t, null_logger_t >
using | tls_socket_t = impl::tls_socket_t
| A public alias for the actual implementation of TLS-socket.
template<typename Traits >
using | request_handler_type_from_traits_t = typename details::actual_request_handler_type_detector< typename Traits::request_handler_t, typename Traits::extra_data_factory_t >::request_handler_t
| A metafunction for extraction a request-handler type from server's traits.
template<typename Traits >
using | generic_request_type_from_traits_t = generic_request_t< typename Traits::extra_data_factory_t::data_t >
| A metafunction for the detection of actual type of request-object from server's traits.
template<typename Timer_Manager , typename Logger , typename Request_Handler = details::autodetect_request_handler_type>
using | single_thread_traits_t = traits_t< Timer_Manager, Logger, Request_Handler, noop_strand_t >
using | default_traits_t = traits_t< asio_timer_manager_t, null_logger_t >
using | default_single_thread_traits_t = single_thread_traits_t< asio_timer_manager_t, null_logger_t >
| Default traits for single-threaded HTTP-server.
template<typename... Types>
using | variant_t = nonstd::variant< Types... >
Aliases for sendfile operation.
using | file_descriptor_t = std::FILE *
using | file_offset_t = std::int64_t
using | file_size_t = std::uint64_t

## Enumerations

enum class | asio_convertible_error_t : int { write_was_not_executed = 100 , write_group_destroyed_passively , async_write_call_failed , async_read_some_at_call_failed }
| Enum for restinio errors that must presented as asio_ns::error_code value. More...
enum class | writable_item_type_t { trivial_write_operation , file_write_operation }
| Buffers write operation type. More...
enum class | request_handling_status_t : std::uint8_t { accepted , rejected , not_handled }
| Request handling status. More...
enum class | response_parts_attr_t : std::uint8_t { not_final_parts , final_parts }
| Attribute for parts. More...
enum class | response_connection_attr_t : std::uint8_t { connection_keepalive , connection_close }
| Attribute for parts. More...
enum class | http_field_t : std::uint8_t { RESTINIO_HTTP_FIELD_GEN , field_unspecified }
| C++ enum that repeats nodejs c-style enum. More...
enum class | break_signal_handling_t { used , skipped }
| Indication of usage of break signal handlers for some forms of run functions. More...

## Functions

const error_category_base_t & | restinio_err_category ()
| Get restinio error category.
asio_ns::error_code | make_asio_compaible_error (asio_convertible_error_t err) noexcept
| Make restinio error_code compatible with asio_ns::error_code.
template<typename Value_Type >
Value_Type | cast_to (string_view_t str_representation)
| Cast string representation to a given type.
std::ostream & | operator<< (std::ostream &o, response_parts_attr_t attr)
std::ostream & | operator<< (std::ostream &o, response_connection_attr_t attr)
response_connection_attr_t | response_connection_attr (bool should_keep_alive)
std::ostream & | operator<< (std::ostream &o, const response_output_flags_t &flags)
template<bool Condition, typename If_Part , typename Else_Part >
decltype(auto) | static_if_else (If_Part &&if_part, Else_Part &&else_part)
| An emulation of if constexpr for C++14.
io_context_holder_t | own_io_context ()
| Function which tells that http_server should create and use its own instance of io_context.
io_context_holder_t | external_io_context (asio_ns::io_context &ctx)
| Function which tells that http_server should use external instance of io_context and should not controll its lifetime.
constexpr break_signal_handling_t | use_break_signal_handling () noexcept
| Make the indicator for usage of break signal handler.
constexpr break_signal_handling_t | skip_break_signal_handling () noexcept
| Make the indicator for absence of break signal handler.
template<typename Traits = default_single_thread_traits_t>
run_on_this_thread_settings_t< Traits > | on_this_thread ()
| A special marker for the case when http_server must be run on the context of the current thread.
template<typename Traits = default_traits_t>
run_on_thread_pool_settings_t< Traits > | on_thread_pool (std::size_t pool_size)
| A special marker for the case when http_server must be run on an thread pool.
template<typename Traits >
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.
template<typename Traits >
void | run (run_on_this_thread_settings_t< Traits > &&settings)
| Helper function for running http server until ctrl+c is hit.
template<typename Traits >
void | run (run_on_thread_pool_settings_t< Traits > &&settings)
| Helper function for running http server until ctrl+c is hit.
template<typename Traits >
void | run (asio_ns::io_context &ioctx, run_on_thread_pool_settings_t< Traits > &&settings)
| Helper function for running http server until ctrl+c is hit.
template<typename Traits >
run_existing_server_on_thread_pool_t< Traits > | on_thread_pool (std::size_t pool_size, break_signal_handling_t break_handling, http_server_t< Traits > &server)
| Helper function for running an existing HTTP-server on a thread pool.
template<typename Traits >
void | run (run_existing_server_on_thread_pool_t< Traits > &&params)
| Helper function for running an existing HTTP-server on a thread pool.
template<typename Traits >
void | initiate_shutdown (http_server_t< Traits > &server)
| Helper function for initiation of server shutdown.
template<typename Traits = default_traits_t>
RESTINIO_NODISCARD running_server_handle_t< Traits > | run_async (io_context_holder_t io_context, server_settings_t< Traits > &&settings, std::size_t thread_pool_size)
| Creates an instance of HTTP-server and launches it on a separate thread or thread pool.
std::string | make_date_field_value (std::time_t t)
| Format a timepoint to a string of a propper format.
std::string | make_date_field_value (std::chrono::system_clock::time_point tp)
template<typename Extra_Data >
std::ostream & | operator<< (std::ostream &o, const generic_request_t< Extra_Data > &req)
template<typename Value_Type >
Value_Type | get (const router::route_params_t &params, string_view_t key)
| Cast named parameter value to a given type.
template<typename Value_Type >
Value_Type | get (const router::route_params_t &params, std::size_t index)
| Cast indexed parameter value to a given type.
template<typename Object >
auto | create_default_unique_object_instance ()
| Default instantiation for a specific type.
template<>
auto | create_default_unique_object_instance< default_request_handler_t > ()
| Default instantiation for default_request_handler_t.
template<typename Object >
auto | create_default_shared_object_instance ()
| Default instantiation for a specific type.
template<>
auto | create_default_shared_object_instance< default_request_handler_t > ()
| Default instantiation for default_request_handler_t.
template<typename Object >
auto | ensure_created (std::unique_ptr< Object > mb_created_one, string_view_t fail_description)
| Ensure that object was created.
template<typename Object >
auto | ensure_created (std::shared_ptr< Object > mb_created_one, string_view_t fail_description)
| Ensure that object was created.
template<>
auto | create_default_unique_object_instance< acceptor_options_setter_t > ()
template<>
auto | create_default_unique_object_instance< socket_options_setter_t > ()
template<typename Traits , typename Configurator >
auto | exec_configurator (Configurator &&configurator)
template<typename Connection , typename Start_Read_CB , typename Failed_CB >
void | prepare_connection_and_start_read (tls_socket_t &socket, Connection &con, Start_Read_CB start_read_cb, Failed_CB failed_cb)
| Customizes connection init routine with an additional step: perform handshake and only then start reading.
template<typename Value_Type >
Value_Type | get (const query_string_params_t &params, string_view_t key)
| Cast query string parameter to a given type.
template<typename Parse_Traits >
RESTINIO_NODISCARD expected_t< query_string_params_t, parse_query_failure_t > | try_parse_query (string_view_t original_query_string)
| Helper function for parsing query string.
template<typename Parse_Traits = parse_query_traits::restinio_defaults>
RESTINIO_NODISCARD query_string_params_t | parse_query (string_view_t original_query_string)
| Parse query key-value parts.
template<typename Value_Type , typename Parameter_Container >
std::enable_if< std::is_same< Parameter_Container, query_string_params_t >::value||std::is_same< Parameter_Container, router::route_params_t >::value, Value_Type >::type | value_or (const Parameter_Container &params, string_view_t key, Value_Type default_value)
| Get parameter value or a given default.
template<typename Value_Type , typename Parameter_Container >
std::enable_if< std::is_same< Parameter_Container, query_string_params_t >::value||std::is_same< Parameter_Container, router::route_params_t >::value, optional_t< Value_Type > >::type | opt_value (const Parameter_Container &params, string_view_t key)
| Gets the value of a parameter specified by key wrapped in `optional_t<Value_Type>` if parameter exists and empty `optional_t<Value_Type>` if parameter with a given key value doesn't exist.
Adoptation functions to cover differences between snad-alone and beast asio.
bool | error_is_operation_aborted (const asio_ns::error_code &ec) noexcept
bool | error_is_eof (const asio_ns::error_code &ec) noexcept
Create const buffers.
constexpr const_buffer_t | const_buffer (const void *str, std::size_t size) noexcept
const_buffer_t | const_buffer (const char *str) noexcept
Helper funcs for working with request_handling_status_t

See also
  request_handling_status_t.

RESTINIO_NODISCARD constexpr request_handling_status_t | request_accepted () noexcept
RESTINIO_NODISCARD constexpr request_handling_status_t | request_rejected () noexcept
RESTINIO_NODISCARD constexpr request_handling_status_t | request_not_handled () noexcept
RFC 2616 statuses.
Codes defined by RFC 2616: https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1.
http_status_line_t | status_continue ()
http_status_line_t | status_switching_protocols ()
http_status_line_t | status_ok ()
http_status_line_t | status_created ()
http_status_line_t | status_accepted ()
http_status_line_t | status_non_authoritative_information ()
http_status_line_t | status_no_content ()
http_status_line_t | status_reset_content ()
http_status_line_t | status_partial_content ()
http_status_line_t | status_multiple_choices ()
http_status_line_t | status_moved_permanently ()
http_status_line_t | status_found ()
http_status_line_t | status_see_other ()
http_status_line_t | status_not_modified ()
http_status_line_t | status_use_proxy ()
http_status_line_t | status_temporary_redirect ()
http_status_line_t | status_bad_request ()
http_status_line_t | status_unauthorized ()
http_status_line_t | status_payment_required ()
http_status_line_t | status_forbidden ()
http_status_line_t | status_not_found ()
http_status_line_t | status_method_not_allowed ()
http_status_line_t | status_not_acceptable ()
http_status_line_t | status_proxy_authentication_required ()
http_status_line_t | status_request_time_out ()
http_status_line_t | status_conflict ()
http_status_line_t | status_gone ()
http_status_line_t | status_length_required ()
http_status_line_t | status_precondition_failed ()
http_status_line_t | status_payload_too_large ()
http_status_line_t | status_uri_too_long ()
http_status_line_t | status_unsupported_media_type ()
http_status_line_t | status_requested_range_not_satisfiable ()
http_status_line_t | status_expectation_failed ()
http_status_line_t | status_internal_server_error ()
http_status_line_t | status_not_implemented ()
http_status_line_t | status_bad_gateway ()
http_status_line_t | status_service_unavailable ()
http_status_line_t | status_gateway_time_out ()
http_status_line_t | status_http_version_not_supported ()
Additional statuses.
Not covered with RFC 2616.
http_status_line_t | status_permanent_redirect ()
http_status_line_t | status_processing ()
http_status_line_t | status_multi_status ()
http_status_line_t | status_unprocessable_entity ()
http_status_line_t | status_locked ()
http_status_line_t | status_failed_dependency ()
http_status_line_t | status_insufficient_storage ()
http_status_line_t | status_precondition_required ()
http_status_line_t | status_too_many_requests ()
http_status_line_t | status_request_header_fields_too_large ()
http_status_line_t | status_network_authentication_required ()
Functions for creating sendfile_t objects.

A group of function to create sendfile_t, that is convertad to writable items used as a part of response.

Since
  v.0.4.3

sendfile_t | sendfile (file_descriptor_holder_t fd, file_meta_t meta, file_size_t chunk_size=sendfile_default_chunk_size) noexcept
sendfile_t | sendfile (const char *file_path, file_size_t chunk_size=sendfile_default_chunk_size)
sendfile_t | sendfile (const std::string &file_path, file_size_t chunk_size=sendfile_default_chunk_size)
sendfile_t | sendfile (string_view_t file_path, file_size_t chunk_size=sendfile_default_chunk_size)
File operations.
A minimal set of file operations. Incapsulates details of native API for a set of file operations neccessary for sendfile_t class implementation.
constexpr file_descriptor_t | null_file_descriptor ()
| Get file descriptor which stands for null.
file_descriptor_t | open_file (const char *file_path)
| Open file.
template<typename META >
META | get_file_meta (file_descriptor_t fd)
| Get file size.
void | close_file (file_descriptor_t fd)
| Close file by its descriptor.

## Variables

constexpr file_size_t | sendfile_default_chunk_size = 1024 * 1024
| Default chunk size for sendfile operation.
constexpr file_size_t | sendfile_max_chunk_size = 1024 * 1024 * 1024
| Maximum size of a chunk.
enum class | http_connection_header_t : std::uint8_t { keep_alive , close , upgrade }
| Values for conection header field. More...
http_field_t | string_to_field (string_view_t field) noexcept
| Helper function to get method string name.
const char * | field_to_string (http_field_t f) noexcept
| Helper sunction to get method string name.
std::ostream & | operator<< (std::ostream &to, const http_method_id_t &m)
constexpr http_method_id_t | http_method_unknown ()
std::ostream & | operator<< (std::ostream &o, const http_status_line_t &status_line)

## Detailed Description

Timer factory implementation using asio timers.

Restinio buffers.

Cast.

Restinio common types.

Exception class for all exceptions thrown by RESTinio.

Adoption for std::expected (c++20).

Since
  v.0.6.1

helpers for http communication.

HTTP-Server.

HTTP-Acceptor handler routine.

HTTP-connection routine.

A base class for connection handle.

Connection settings.

Execution mixin.

Fixed size buffer.

HTTP-Connection handler routine.

Coordinator for process od sending responses with respect to http pipeline technique and chunk transfer.

sendfile routine.

Socket adapter for asio::ssl::stream< asio::ip::tcp::socket >.

Helper output context for writing buffers to output stream (socket).

Builders for messages.

Ready to use loggers implementations.

No-op timer factory implementation.

Adoption for std::optional (c++17).

Since
  v.0.4.4

OS specific functions.

Ready to use logger implementation for using with std::ostream.

Utility for converting express.js style routes to regexp.

Code adopted from https://github.com/pillarjs/path-to-regexp.

HTTP-request handlers routine.

Regex engine for using std::regex.

Express.js style router.

Sendfile routine.

Since
  v.0.4.3

Sendfile routine definitions (default implementation via <cstdio>).

Since
  v.0.4.3

Sendfile routine definitions (posix implementation).

Since
  v.0.4.3

HTTP-Server configuration.

Timers implementation with sobjectizer timers.

Adoption for std::string_view (c++17).

A base class for all classes that deal with connection context.

Support for https.

HTTP server traits.

Transformator of data streams using zlib.

Since
  v.0.4.4

escape functions.

Base64 implementation.

Convert strings to numeric types.

Helpers for extraction group of bits from numbers.

Percent encoding routine.

SHA1 implementation.

Helper functions for parameter extraction with default values.

Since
  v.0.4.4

Adoption for std::variant (c++17).

Since
  v.0.4.8

UTF-8 .

WebSocket connection routine.

Websocket.

Protocol header validator.

WebSocket messgage handler definition.

## Typedef Documentation

## acceptor_options_setter_t

using restinio::acceptor_options_setter_t = typedef std::function< void ( acceptor_options_t & ) >

Definition at line 226 of file settings.hpp.

## acceptor_post_bind_hook_t

using restinio::acceptor_post_bind_hook_t = typedef std::function< void(asio_ns::ip::tcp::acceptor &) >

A type of callback to be called after a successful invocation of bind() function for the acceptor.

Since
  v.0.6.11

Definition at line 434 of file settings.hpp.

## chunked_input_info_unique_ptr_t

using restinio::chunked_input_info_unique_ptr_t = typedef std::unique_ptr< chunked_input_info_t >

Alias of unique_ptr for chunked_input_info.

Since
  v.0.6.9

Definition at line 231 of file chunked_input_info.hpp.

## cleanup_functor_t

using restinio::cleanup_functor_t = typedef std::function< void(void) >

Type of holder for user's cleanup function.

Definition at line 308 of file settings.hpp.

## connection_id_t

using restinio::connection_id_t = typedef std::uint64_t

Type for ID of connection.

Definition at line 174 of file common_types.hpp.

## default_asio_executor

using restinio::default_asio_executor = typedef asio_ns::executor

Definition at line 224 of file asio_include.hpp.

## default_request_handler_t

using restinio::default_request_handler_t = typedef std::function< request_handling_status_t ( request_handle_t ) >

Definition at line 477 of file request_handler.hpp.

## default_single_thread_traits_t

using restinio::default_single_thread_traits_t = typedef single_thread_traits_t< asio_timer_manager_t, null_logger_t >

Default traits for single-threaded HTTP-server.

Uses default timer manager. And null logger.

Usage example:

struct my_traits : public restinio::default_single_thread_traits_t {
using logger_t = my_special_single_threaded_logger_type;
};
restinio::traits_t
Definition: traits.hpp:147

Since
  v.0.4.0

Definition at line 430 of file traits.hpp.

## default_strand_t

using restinio::default_strand_t = typedef asio_ns::strand< default_asio_executor >

A typedef for the default strand type.

Since
  v.0.6.12

Definition at line 23 of file default_strands.hpp.

## default_tls_traits_t

using restinio::default_tls_traits_t = typedef tls_traits_t< asio_timer_manager_t, null_logger_t >

Definition at line 152 of file tls.hpp.

## default_traits_t

using restinio::default_traits_t = typedef traits_t< asio_timer_manager_t, null_logger_t >

Definition at line 413 of file traits.hpp.

## endpoint_t

using restinio::endpoint_t = typedef asio_ns::ip::tcp::endpoint

An alias for endpoint type from Asio.

Definition at line 177 of file common_types.hpp.

## error_category_base_t

using restinio::error_category_base_t = typedef asio_ns::error_category

An alias for base class of error category entity.

Definition at line 47 of file asio_include.hpp.

## expected_t

template<typename T , typename E >

using restinio::expected_t = typedef nonstd::expected<T, E>

Definition at line 22 of file expected.hpp.

## file_descriptor_t

typedef int restinio::file_descriptor_t

Definition at line 21 of file sendfile_defs_default.hpp.

## file_offset_t

typedef std::int64_t restinio::file_offset_t

Definition at line 22 of file sendfile_defs_default.hpp.

## file_size_t

typedef std::uint64_t restinio::file_size_t

Definition at line 23 of file sendfile_defs_default.hpp.

## fmt_minimal_memory_buffer_t

using restinio::fmt_minimal_memory_buffer_t = typedef fmt::basic_memory_buffer<char, 1u>

An alias for fmt::basic_memory_buffer<char,1>.

Since
  v.0.6.3

Definition at line 39 of file buffers.hpp.

## generic_request_handle_t

template<typename Extra_Data >

using restinio::generic_request_handle_t = typedef std::shared_ptr< generic_request_t< Extra_Data > >

An alias for shared-pointer to incoming request.

Definition at line 454 of file request_handler.hpp.

## generic_request_type_from_traits_t

template<typename Traits >

using restinio::generic_request_type_from_traits_t = typedef generic_request_t< typename Traits::extra_data_factory_t::data_t >

A metafunction for the detection of actual type of request-object from server's traits.

The actual type of request-object depends from extra-data-factory. This metafunction detect the actual type with the respect to the definition of `extra_data_factory_t` inside Traits.

Since
  v.0.6.13

Definition at line 395 of file traits.hpp.

## http_field

using restinio::http_field = typedef http_field_t

Helper alies to omitt `_t` suffix.

Definition at line 242 of file http_headers.hpp.

## io_context_shared_ptr_t

using restinio::io_context_shared_ptr_t = typedef std::shared_ptr< asio_ns::io_context >

Definition at line 25 of file http_server.hpp.

## noop_strand_t

using restinio::noop_strand_t = typedef default_asio_executor

A typedef for no-op strand type.

Definition at line 28 of file default_strands.hpp.

## not_null_pointer_t

template<typename T >

using restinio::not_null_pointer_t = typedef T*

Type for pointer that is not null by design.

Note
  There is no any compile-time or run-time checks for a value of the pointer. It is just a flag that we don't expect a nullptr here by design.

Since
  v.0.4.9

Definition at line 169 of file common_types.hpp.

## nullable_pointer_t

template<typename T >

using restinio::nullable_pointer_t = typedef T*

Type for pointer that can be nullptr.

This type is used in methods which return raw pointers. It indicates that returned value should be checked for nullptr.

Since
  v.0.4.9

Definition at line 154 of file common_types.hpp.

## optional_t

template<class T >

using restinio::optional_t = typedef nonstd::optional< T >

Definition at line 22 of file optional.hpp.

## request_handle_t

using restinio::request_handle_t = typedef std::shared_ptr< request_t >

An alias for handle for incoming request without additional extra-data.

For compatibility with previous versions.

Since
  v.0.6.13

Definition at line 471 of file request_handler.hpp.

## request_handler_type_from_traits_t

template<typename Traits >

using restinio::request_handler_type_from_traits_t = typedef typename details::actual_request_handler_type_detector< typename Traits::request_handler_t, typename Traits::extra_data_factory_t >::request_handler_t

A metafunction for extraction a request-handler type from server's traits.

This metafunction is necessary because `request_handler_t` in Traits can be an alias for details::autodetect_request_handler_type. Because of that details::actual_request_handler_type_detector metafunction is invoked for the detection of request-handler type.

Since
  v.0.6.13

Definition at line 375 of file traits.hpp.

## request_id_t

using restinio::request_id_t = typedef unsigned int

Request id in scope of single connection.

Definition at line 70 of file common_types.hpp.

## request_t

using restinio::request_t = typedef generic_request_t< no_extra_data_factory_t::data_t >

An alias for incoming request without additional extra-data.

For compatibility with previous versions.

Since
  v.0.6.13

Definition at line 463 of file request_handler.hpp.

## running_server_handle_t

template<typename Traits >

using restinio::running_server_handle_t = typedef std::unique_ptr< running_server_instance_t< http_server_t<Traits> > >

The type to be used as a handle for running server instance.

The handle should be seen as a Moveable and not Copyable type.

Since
  v.0.6.7

Definition at line 922 of file http_server_run.hpp.

## shared_ostream_logger_t

using restinio::shared_ostream_logger_t = typedef ostream_logger_t< std::mutex >

Examples
  sample/async_handling_with_sobjectizer/main.cpp, sample/file_upload/main.cpp, and sample/ip_blocker/main.cpp.

Definition at line 104 of file ostream_logger.hpp.

## single_thread_tls_traits_t

template<typename Timer_Factory , typename Logger , typename Request_Handler = default_request_handler_t>

using restinio::single_thread_tls_traits_t = typedef tls_traits_t< Timer_Factory, Logger, Request_Handler, noop_strand_t >

Definition at line 149 of file tls.hpp.

## single_thread_traits_t

template<typename Timer_Manager , typename Logger , typename Request_Handler = details::autodetect_request_handler_type>

using restinio::single_thread_traits_t = typedef traits_t< Timer_Manager, Logger, Request_Handler, noop_strand_t >

Definition at line 406 of file traits.hpp.

## single_threaded_ostream_logger_t

using restinio::single_threaded_ostream_logger_t = typedef ostream_logger_t< null_mutex_t >

Examples
  sample/chained_handlers/main.cpp, sample/express_router/main.cpp, sample/express_router_tutorial/main.cpp, sample/extra_data_factory/main.cpp, sample/hello_world/main.cpp, sample/hello_world_https/main.cpp, sample/shared_tls_context/main.cpp, sample/websocket/main.cpp, sample/websocket_detailed/main.cpp, and sample/websocket_wss/main.cpp.

Definition at line 103 of file ostream_logger.hpp.

## socket_options_setter_t

using restinio::socket_options_setter_t = typedef std::function< void ( socket_options_t & ) >

Definition at line 293 of file settings.hpp.

## string_view_t

using restinio::string_view_t = typedef nonstd::string_view

Definition at line 19 of file string_view.hpp.

## tcp_connection_ctx_handle_t

using restinio::tcp_connection_ctx_handle_t = typedef std::shared_ptr< tcp_connection_ctx_base_t >

Alias for http connection handle.

Definition at line 62 of file tcp_connection_ctx_base.hpp.

## tcp_connection_ctx_weak_handle_t

typedef std::weak_ptr< tcp_connection_ctx_base_t > restinio::tcp_connection_ctx_weak_handle_t

Alias for http connection weak handle.

Definition at line 65 of file tcp_connection_ctx_base.hpp.

## timer_invocation_cb_t

using restinio::timer_invocation_cb_t = typedef std::add_pointer< void ( timer_invocation_tag_t , tcp_connection_ctx_weak_handle_t ) >::type

A pointer to invocation callback for a specific context object.

Definition at line 23 of file timer_common.hpp.

## timer_invocation_tag_t

using restinio::timer_invocation_tag_t = typedef std::uint32_t

An invokation tag, for controlling no more actual timers in corner cases.

Definition at line 20 of file timer_common.hpp.

## tls_socket_t

using restinio::tls_socket_t = typedef impl::tls_socket_t

A public alias for the actual implementation of TLS-socket.

Definition at line 30 of file tls_fwd.hpp.

## tls_traits_t

template<typename Timer_Factory , typename Logger , typename Request_Handler = default_request_handler_t, typename Strand = asio_ns::strand< default_asio_executor >>

using restinio::tls_traits_t = typedef traits_t< Timer_Factory, Logger, Request_Handler, Strand, tls_socket_t >

Definition at line 139 of file tls.hpp.

## variant_t

template<typename... Types>

using restinio::variant_t = typedef nonstd::variant< Types... >

Definition at line 22 of file variant.hpp.

## writable_items_container_t

using restinio::writable_items_container_t = typedef std::vector< writable_item_t >

Definition at line 705 of file buffers.hpp.

## write_status_cb_t

using restinio::write_status_cb_t = typedef std::function< void( const asio_ns::error_code & ec ) >

An alias for a callback to be invoked after the write operation of a particular group of "buffers".

Since
  v.0.4.8

Definition at line 716 of file buffers.hpp.

## Enumeration Type Documentation

## asio_convertible_error_t

enum class restinio::asio_convertible_error_t : int

strong

Enum for restinio errors that must presented as asio_ns::error_code value.

Enumerator
write_was_not_executed | After write notificator error: data was not sent, connection closed (or aborted) before a given piece of data.
write_group_destroyed_passively | After write notificator error: a notificator was set for a write_group_t but no external invokation happened, so write_group_t destructor calls it with error.

async_write_call_failed

A call to async_write failed. The corresponding write operation wasn't done.

Since
  v.0.6.0

async_read_some_at_call_failed

A call to async_read_some_at failed. The corresponding sendfile operation wasn't done.

Since
  v.0.6.0

Definition at line 121 of file asio_include.hpp.

## break_signal_handling_t

enum class restinio::break_signal_handling_t

strong

Indication of usage of break signal handlers for some forms of run functions.

Since
  v.0.5.1

Enumerator
used | Signal handler should be used by run() function.
skipped | Signal handler should not be used by run() function.

Definition at line 28 of file http_server_run.hpp.

## http_connection_header_t

enum class restinio::http_connection_header_t : std::uint8_t

strong

Values for conection header field.

Enumerator
keep_alive |
close |
upgrade |

Definition at line 1567 of file http_headers.hpp.

## http_field_t

enum class restinio::http_field_t : std::uint8_t

strong

C++ enum that repeats nodejs c-style enum.

Note
  Fields `Connection` and `Content-Length` are specieal cases, thus they are not present in the list.

Enumerator
RESTINIO_HTTP_FIELD_GEN |
field_unspecified |

Definition at line 232 of file http_headers.hpp.

## request_handling_status_t

enum class restinio::request_handling_status_t : std::uint8_t

strong

Request handling status.

If handler handles request it must return accepted.

If handler refuses to handle request it must return rejected.

Enumerator
accepted | Request accepted for handling.
rejected | Request wasn't accepted for handling.

not_handled

The request wasn't handled. If there is another handler to be tried it should be tried. Otherwise the request has to be rejected.

Since
  v.0.6.13.

Definition at line 25 of file common_types.hpp.

## response_connection_attr_t

enum class restinio::response_connection_attr_t : std::uint8_t

strong

Attribute for parts.

Enumerator
connection_keepalive | This response says to keep connection.
connection_close | This response says to close connection.

Definition at line 93 of file common_types.hpp.

## response_parts_attr_t

enum class restinio::response_parts_attr_t : std::uint8_t

strong

Attribute for parts.

Enumerator
not_final_parts | Intermediate parts (more parts of response to follow).
final_parts | Final parts (response ands with these parts).

Definition at line 73 of file common_types.hpp.

## writable_item_type_t

enum class restinio::writable_item_type_t

strong

Buffers write operation type.

Enumerator
trivial_write_operation | Item is a buffer and must be written trivially.
file_write_operation | Item is a sendfile operation and implicates file write operation.

Definition at line 441 of file buffers.hpp.

## Function Documentation

## cast_to()

template<typename Value_Type >

Value_Type restinio::cast_to | ( | string_view_t | str_representation | ) |

Cast string representation to a given type.

Definition at line 27 of file cast_to.hpp.

## close_file()

void restinio::close_file | ( | file_descriptor_t | fd | ) |

inline

Close file by its descriptor.

Definition at line 93 of file sendfile_defs_default.hpp.

## const_buffer() [1/2]

const_buffer_t restinio::const_buffer | ( | const char * | str | ) |

inline noexcept

Definition at line 430 of file buffers.hpp.

## const_buffer() [2/2]

constexpr const_buffer_t restinio::const_buffer | ( | const void * | str,
|  | std::size_t | size
| ) |  |

inline constexpr noexcept

Definition at line 424 of file buffers.hpp.

## create_default_shared_object_instance()

template<typename Object >

auto restinio::create_default_shared_object_instance | ( |  | ) |

inline

Default instantiation for a specific type.

Definition at line 92 of file settings.hpp.

## create_default_shared_object_instance< default_request_handler_t >()

template<>

auto restinio::create_default_shared_object_instance< default_request_handler_t > | ( |  | ) |

inline

Default instantiation for default_request_handler_t.

Definition at line 100 of file settings.hpp.

## create_default_unique_object_instance()

template<typename Object >

auto restinio::create_default_unique_object_instance | ( |  | ) |

inline

Default instantiation for a specific type.

Definition at line 70 of file settings.hpp.

## create_default_unique_object_instance< acceptor_options_setter_t >()

template<>

auto restinio::create_default_unique_object_instance< acceptor_options_setter_t > | ( |  | ) |

inline

Definition at line 229 of file settings.hpp.

## create_default_unique_object_instance< default_request_handler_t >()

template<>

auto restinio::create_default_unique_object_instance< default_request_handler_t > | ( |  | ) |

inline

Default instantiation for default_request_handler_t.

Definition at line 78 of file settings.hpp.

## create_default_unique_object_instance< socket_options_setter_t >()

template<>

auto restinio::create_default_unique_object_instance< socket_options_setter_t > | ( |  | ) |

inline

Definition at line 296 of file settings.hpp.

## ensure_created() [1/2]

template<typename Object >

auto restinio::ensure_created | ( | std::shared_ptr< Object > | mb_created_one,
|  | string_view_t | fail_description
| ) |  |

Ensure that object was created.

Definition at line 134 of file settings.hpp.

## ensure_created() [2/2]

template<typename Object >

auto restinio::ensure_created | ( | std::unique_ptr< Object > | mb_created_one,
|  | string_view_t | fail_description
| ) |  |

Ensure that object was created.

Definition at line 114 of file settings.hpp.

## error_is_eof()

bool restinio::error_is_eof | ( | const asio_ns::error_code & | ec | ) |

inline noexcept

Definition at line 33 of file asio_include.hpp.

## error_is_operation_aborted()

bool restinio::error_is_operation_aborted | ( | const asio_ns::error_code & | ec | ) |

inline noexcept

Definition at line 27 of file asio_include.hpp.

## exec_configurator()

template<typename Traits , typename Configurator >

auto restinio::exec_configurator | ( | Configurator && | configurator | ) |

Definition at line 1778 of file settings.hpp.

## external_io_context()

io_context_holder_t restinio::external_io_context | ( | asio_ns::io_context & | ctx | ) |

inline

Function which tells that http_server should use external instance of io_context and should not controll its lifetime.

Usage example:

asio::io_context ctx;
...
restinio::http_server_t<> server(
restinio::external_io_context(ctx),
restinio::server_settings_t<>()...);
restinio::server_settings_t
A fluent style interface for setting http server params.
Definition: settings.hpp:1769
restinio::external_io_context
io_context_holder_t external_io_context(asio_ns::io_context &ctx)
Function which tells that http_server should use external instance of io_context and should not contr...
Definition: http_server.hpp:87

Examples
  sample/using_external_io_context/main.cpp.

Definition at line 87 of file http_server.hpp.

## field_to_string()

const char * restinio::field_to_string | ( | http_field_t | f | ) |

inline noexcept

Helper sunction to get method string name.

Definition at line 553 of file http_headers.hpp.

## get() [1/3]

template<typename Value_Type >

Value_Type restinio::get | ( | const query_string_params_t & | params,
|  | string_view_t | key
| ) |  |

Cast query string parameter to a given type.

Definition at line 175 of file uri_helpers.hpp.

## get() [2/3]

template<typename Value_Type >

Value_Type restinio::get | ( | const router::route_params_t & | params,
|  | std::size_t | index
| ) |  |

Cast indexed parameter value to a given type.

Definition at line 862 of file express.hpp.

## get() [3/3]

template<typename Value_Type >

Value_Type restinio::get | ( | const router::route_params_t & | params,
|  | string_view_t | key
| ) |  |

Cast named parameter value to a given type.

Definition at line 854 of file express.hpp.

## get_file_meta()

template<typename META >

META restinio::get_file_meta | ( | file_descriptor_t | fd | ) |

Get file size.

Get file meta.

Definition at line 59 of file sendfile_defs_default.hpp.

## http_method_unknown()

constexpr http_method_id_t restinio::http_method_unknown | ( |  | ) |

inline constexpr

Definition at line 1809 of file http_headers.hpp.

## initiate_shutdown()

template<typename Traits >

void restinio::initiate_shutdown | ( | http_server_t< Traits > & | server | ) |

inline

Helper function for initiation of server shutdown.

Can be useful if an existing HTTP-server is run via run() function. For example:

restinio::http_server_t< my_traits > server{ ... };
// Launch another thread that will perform some application logic.
std::thread app_logic_thread{ [&server] {
while(some_condition) {
...
if(exit_case) {
// HTTP-server should be shut down.
restinio::initiate_shutdown( server );
// Our work should be finished.
return;
}
}
} };
// Start HTTP-server. The current thread will be blocked until
// run() returns.
restinio::run( restinio::on_thread_pool(
4,
restinio::skip_break_signal_handling(),
server) );
// Now app_logic_thread can be joined.
app_logic_thread.join();
restinio::http_server_t
Class for http-server.
Definition: http_server.hpp:169
restinio::skip_break_signal_handling
constexpr break_signal_handling_t skip_break_signal_handling() noexcept
Make the indicator for absence of break signal handler.
Definition: http_server_run.hpp:69
restinio::on_thread_pool
run_on_thread_pool_settings_t< Traits > on_thread_pool(std::size_t pool_size)
A special marker for the case when http_server must be run on an thread pool.
Definition: http_server_run.hpp:183
restinio::run
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.
Definition: http_server_run.hpp:216
restinio::initiate_shutdown
void initiate_shutdown(http_server_t< Traits > &server)
Helper function for initiation of server shutdown.
Definition: http_server_run.hpp:681

Since
  v.0.5.1

Definition at line 681 of file http_server_run.hpp.

## make_asio_compaible_error()

asio_ns::error_code restinio::make_asio_compaible_error | ( | asio_convertible_error_t | err | ) |

inline noexcept

Make restinio error_code compatible with asio_ns::error_code.

Definition at line 210 of file asio_include.hpp.

## make_date_field_value() [1/2]

std::string restinio::make_date_field_value | ( | std::chrono::system_clock::time_point | tp | ) |

inline

Definition at line 49 of file message_builders.hpp.

## make_date_field_value() [2/2]

std::string restinio::make_date_field_value | ( | std::time_t | t | ) |

inline

Format a timepoint to a string of a propper format.

Definition at line 33 of file message_builders.hpp.

## null_file_descriptor()

constexpr file_descriptor_t restinio::null_file_descriptor | ( |  | ) |

constexpr

Get file descriptor which stands for null.

Definition at line 36 of file sendfile_defs_default.hpp.

## on_this_thread()

template<typename Traits = default_single_thread_traits_t>

run_on_this_thread_settings_t< Traits > restinio::on_this_thread | ( |  | ) |

A special marker for the case when http_server must be run on the context of the current thread.

Usage example:

// Run with the default traits.
run( restinio::on_this_thread()
.port(8080)
.address("localhost")
.request_handler(...) );
restinio::on_this_thread
run_on_this_thread_settings_t< Traits > on_this_thread()
A special marker for the case when http_server must be run on the context of the current thread.
Definition: http_server_run.hpp:123

For a case when some custom traits must be used:

run( restinio::on_this_thread<my_server_traits_t>()
.port(8080)
.address("localhost")
.request_handler(...) );

Definition at line 123 of file http_server_run.hpp.

## on_thread_pool() [1/2]

template<typename Traits = default_traits_t>

run_on_thread_pool_settings_t< Traits > restinio::on_thread_pool | ( | std::size_t | pool_size | ) |

A special marker for the case when http_server must be run on an thread pool.

Usage example:

// Run with the default traits.
run( restinio::on_thread_pool(16) // 16 -- is the pool size.
.port(8080)
.address("localhost")
.request_handler(...) );

For a case when some custom traits must be used:

run( restinio::on_thread_pool<my_server_traits_t>(16)
.port(8080)
.address("localhost")
.request_handler(...) );

Parameters

  pool_size | Size of the pool.

Examples
  sample/hello_world_basic/main.cpp, sample/hello_world_delayed/main.cpp, sample/query_string_params/main.cpp, and sample/try_parse_query_string/main.cpp.

Definition at line 183 of file http_server_run.hpp.

## on_thread_pool() [2/2]

template<typename Traits >

run_existing_server_on_thread_pool_t< Traits > restinio::on_thread_pool | ( | std::size_t | pool_size,
|  | break_signal_handling_t | break_handling,
|  | http_server_t< Traits > & | server
| ) |  |

Helper function for running an existing HTTP-server on a thread pool.

Usage example:

using my_server_t = restinio::http_server_t< my_server_traits_t >;
my_server_t server{
restinio::own_io_context(),
[](auto & settings) {
settings.port(...);
settings.address(...);
settings.request_handler(...);
...
}
};
...
restinio::run( restinio::on_thread_pool(
std::thread::hardware_concurrency(),
restinio::use_break_signal_handling(),
server) );
restinio::use_break_signal_handling
constexpr break_signal_handling_t use_break_signal_handling() noexcept
Make the indicator for usage of break signal handler.
Definition: http_server_run.hpp:50
restinio::own_io_context
io_context_holder_t own_io_context()
Function which tells that http_server should create and use its own instance of io_context.
Definition: http_server.hpp:65

Since
  v.0.5.1

Definition at line 494 of file http_server_run.hpp.

## open_file()

file_descriptor_t restinio::open_file | ( | const char * | file_path | ) |

inline

Open file.

Definition at line 40 of file sendfile_defs_default.hpp.

## operator<<() [1/6]

template<typename Extra_Data >

std::ostream & restinio::operator<< | ( | std::ostream & | o,
|  | const generic_request_t< Extra_Data > & | req
| ) |  |

Definition at line 439 of file request_handler.hpp.

## operator<<() [2/6]

std::ostream & restinio::operator<< | ( | std::ostream & | o,
|  | const http_status_line_t & | status_line
| ) |  |

inline

Definition at line 2158 of file http_headers.hpp.

## operator<<() [3/6]

std::ostream & restinio::operator<< | ( | std::ostream & | o,
|  | const response_output_flags_t & | flags
| ) |  |

inline

Definition at line 135 of file common_types.hpp.

## operator<<() [4/6]

std::ostream & restinio::operator<< | ( | std::ostream & | o,
|  | response_connection_attr_t | attr
| ) |  |

inline

Definition at line 101 of file common_types.hpp.

## operator<<() [5/6]

std::ostream & restinio::operator<< | ( | std::ostream & | o,
|  | response_parts_attr_t | attr
| ) |  |

inline

Definition at line 81 of file common_types.hpp.

## operator<<() [6/6]

std::ostream & restinio::operator<< | ( | std::ostream & | to,
|  | const http_method_id_t & | m
| ) |  |

inline

Definition at line 1793 of file http_headers.hpp.

## opt_value()

template<typename Value_Type , typename Parameter_Container >

std::enable_if< std::is_same< Parameter_Container, query_string_params_t >::value||std::is_same< Parameter_Container, router::route_params_t >::value, optional_t< Value_Type > >::type restinio::opt_value | ( | const Parameter_Container & | params,
|  | string_view_t | key
| ) |  |

Gets the value of a parameter specified by key wrapped in `optional_t<Value_Type>` if parameter exists and empty `optional_t<Value_Type>` if parameter with a given key value doesn't exist.

If parameter exists in params it is obtained as `string_view_t` object and casted to a necessary type and then is wrapped in `optional_t<Value_Type>`. If params has no such parameters then the empty `optional_t<Value_Type>` is returned.

Since
  v.0.4.5.1

Definition at line 64 of file value_or.hpp.

## own_io_context()

io_context_holder_t restinio::own_io_context | ( |  | ) |

inline

Function which tells that http_server should create and use its own instance of io_context.

Usage example:

restinio::http_server_t<> server(
restinio::own_io_context(),
restinio::server_settings_t<>()... );

Examples
  sample/shared_tls_context/main.cpp.

Definition at line 65 of file http_server.hpp.

## parse_query()

template<typename Parse_Traits = parse_query_traits::restinio_defaults>

RESTINIO_NODISCARD query_string_params_t restinio::parse_query | ( | string_view_t | original_query_string | ) |

Parse query key-value parts.

Since v.0.4.9 this function correctly handles the following cases:

- presence of tag (web beacon) in URI. For example, when URI looks like `http://example.com/resource?tag`. In that case value of the tag (web beacon) can be obtained via query_string_params_t::tag() method. References: web beacon and query-string-tracking;
- usage of `;` instead of `&` as parameter separator.

Since v.0.4.9.1 this function can be parametrized by parser traits. For example:

auto result = restinio::parse_query<restinio::parse_query_traits::javascript_compatible>("name=A*");

Parameters

  original_query_string | Query part of the request target.

Examples
  sample/express_router_tutorial/main.cpp, and sample/query_string_params/main.cpp.

Definition at line 520 of file uri_helpers.hpp.

## prepare_connection_and_start_read()

template<typename Connection , typename Start_Read_CB , typename Failed_CB >

void restinio::prepare_connection_and_start_read | ( | tls_socket_t & | socket,
|  | Connection & | con,
|  | Start_Read_CB | start_read_cb,
|  | Failed_CB | failed_cb
| ) |  |

Customizes connection init routine with an additional step: perform handshake and only then start reading.

Definition at line 162 of file tls.hpp.

## request_accepted()

RESTINIO_NODISCARD constexpr request_handling_status_t restinio::request_accepted | ( |  | ) |

constexpr noexcept

Examples
  sample/chained_handlers/main.cpp, sample/connection_state/main.cpp, sample/extra_data_factory/main.cpp, sample/hello_world/main.cpp, sample/hello_world_basic/main.cpp, sample/hello_world_delayed/main.cpp, sample/hello_world_https/main.cpp, sample/ip_blocker/main.cpp, sample/query_string_params/main.cpp, sample/shared_tls_context/main.cpp, sample/tls_inspector/main.cpp, sample/try_parse_query_string/main.cpp, sample/using_external_io_context/main.cpp, sample/websocket/main.cpp, sample/websocket_detailed/main.cpp, and sample/websocket_wss/main.cpp.

Definition at line 46 of file common_types.hpp.

## request_not_handled()

RESTINIO_NODISCARD constexpr request_handling_status_t restinio::request_not_handled | ( |  | ) |

constexpr noexcept

Since
  v.0.6.13

Examples
  sample/chained_handlers/main.cpp, and sample/extra_data_factory/main.cpp.

Definition at line 63 of file common_types.hpp.

## request_rejected()

RESTINIO_NODISCARD constexpr request_handling_status_t restinio::request_rejected | ( |  | ) |

constexpr noexcept

Examples
  sample/async_handling_with_sobjectizer/main.cpp, sample/connection_state/main.cpp, sample/hello_world_basic/main.cpp, sample/hello_world_delayed/main.cpp, sample/hello_world_sendfile/main.cpp, sample/hello_world_sendfile_https/main.cpp, sample/ip_blocker/main.cpp, sample/query_string_params/main.cpp, sample/try_parse_query_string/main.cpp, sample/using_external_io_context/main.cpp, sample/websocket/main.cpp, sample/websocket_detailed/main.cpp, and sample/websocket_wss/main.cpp.

Definition at line 53 of file common_types.hpp.

## response_connection_attr()

response_connection_attr_t restinio::response_connection_attr | ( | bool | should_keep_alive | ) |

inline

Definition at line 113 of file common_types.hpp.

## restinio_err_category()

const error_category_base_t & restinio::restinio_err_category | ( |  | ) |

inline

Get restinio error category.

Definition at line 199 of file asio_include.hpp.

## run() [1/5]

template<typename Traits >

void restinio::run | ( | asio_ns::io_context & | ioctx,
|  | run_on_this_thread_settings_t< Traits > && | settings
| ) |  |

inline

Helper function for running http server until ctrl+c is hit.

Can be useful when RESTinio server should be run on the user's own io_context instance.

For example:

asio::io_context iosvc;
... // iosvc used by user.
restinio::run(iosvc,
restinio::on_this_thread<my_traits>()
.port(8080)
.address("localhost")
.request_handler([](auto req) {...}));

Since
  v.0.4.2

Parameters

  ioctx | Asio's io_context to be used. Note: this reference should remain valid until RESTinio server finished.
  settings | Settings for that server instance.

Examples
  sample/async_handling_with_sobjectizer/main.cpp, sample/chained_handlers/main.cpp, sample/connection_state/main.cpp, sample/express_router/main.cpp, sample/express_router_tutorial/main.cpp, sample/extra_data_factory/main.cpp, sample/file_upload/main.cpp, sample/hello_world/main.cpp, sample/hello_world_basic/main.cpp, sample/hello_world_delayed/main.cpp, sample/hello_world_https/main.cpp, sample/hello_world_minimal/main.cpp, sample/hello_world_sendfile/main.cpp, sample/hello_world_sendfile_https/main.cpp, sample/ip_blocker/main.cpp, sample/query_string_params/main.cpp, sample/sendfiles/main.cpp, sample/tls_inspector/main.cpp, sample/try_parse_query_string/main.cpp, sample/websocket/main.cpp, sample/websocket_detailed/main.cpp, and sample/websocket_wss/main.cpp.

Definition at line 216 of file http_server_run.hpp.

## run() [2/5]

template<typename Traits >

void restinio::run | ( | asio_ns::io_context & | ioctx,
|  | run_on_thread_pool_settings_t< Traits > && | settings
| ) |  |

inline

Helper function for running http server until ctrl+c is hit.

Can be useful when RESTinio server should be run on the user's own io_context instance.

For example:

asio::io_context iosvc;
... // iosvc used by user.
restinio::run(iosvc,
restinio::on_thread_pool<my_traits>(4)
.port(8080)
.address("localhost")
.request_handler([](auto req) {...}));

Since
  v.0.4.2

Parameters

  ioctx | Asio's io_context to be used. Note: this reference should remain valid until RESTinio server finished.
  settings | Settings for that server instance.

Definition at line 401 of file http_server_run.hpp.

## run() [3/5]

template<typename Traits >

void restinio::run | ( | run_existing_server_on_thread_pool_t< Traits > && | params | ) |

inline

Helper function for running an existing HTTP-server on a thread pool.

Usage example:

using my_server_t = restinio::http_server_t< my_server_traits_t >;
my_server_t server{
restinio::own_io_context(),
[](auto & settings) {
settings.port(...);
settings.address(...);
settings.request_handler(...);
...
}
};
...
// run() returns if Ctrl+C is pressed or if HTTP-server will
// be shut down from elsewhere.
restinio::run( restinio::on_thread_pool(
std::thread::hardware_concurrency(),
restinio::use_break_signal_handling(),
server) );

Since
  v.0.5.1

Definition at line 632 of file http_server_run.hpp.

## run() [4/5]

template<typename Traits >

void restinio::run | ( | run_on_this_thread_settings_t< Traits > && | settings | ) |

inline

Helper function for running http server until ctrl+c is hit.

This function creates its own instance of Asio's io_context and uses it exclusively.

Usage example:

restinio::run(
restinio::on_this_thread<my_traits>()
.port(8080)
.address("localhost")
.request_handler([](auto req) {...}));

Definition at line 283 of file http_server_run.hpp.

## run() [5/5]

template<typename Traits >

void restinio::run | ( | run_on_thread_pool_settings_t< Traits > && | settings | ) |

inline

Helper function for running http server until ctrl+c is hit.

This function creates its own instance of Asio's io_context and uses it exclusively.

Usage example:

restinio::run(
restinio::on_thread_pool<my_traits>(4)
.port(8080)
.address("localhost")
.request_handler([](auto req) {...}));

Definition at line 370 of file http_server_run.hpp.

## run_async()

template<typename Traits = default_traits_t>

RESTINIO_NODISCARD running_server_handle_t< Traits > restinio::run_async | ( | io_context_holder_t | io_context,
|  | server_settings_t< Traits > && | settings,
|  | std::size_t | thread_pool_size
| ) |  |

Creates an instance of HTTP-server and launches it on a separate thread or thread pool.

Usage example:

int main() {
auto server = restinio::run_async(
// Asio's io_context to be used.
// HTTP-server will use own Asio's io_context object.
restinio::own_io_context(),
// The settings for the HTTP-server.
restinio::server_settings_t{}
.address("127.0.0.1")
.port(8080)
.request_handler(...),
// The size of thread-pool for the HTTP-server.
16);
// If we are here and run_async doesn't throw then HTTP-server
// is started.
... // Some other actions.
// No need to stop HTTP-server manually. It will be automatically
// stopped in the destructor of `server` object.
}
restinio::basic_server_settings_t::address
Derived & address(std::string addr) &
Definition: settings.hpp:643
restinio::run_async
RESTINIO_NODISCARD running_server_handle_t< Traits > run_async(io_context_holder_t io_context, server_settings_t< Traits > &&settings, std::size_t thread_pool_size)
Creates an instance of HTTP-server and launches it on a separate thread or thread pool.
Definition: http_server_run.hpp:1112

Or, if user-defined traits should be used:

int main() {
struct my_traits : public restinio::default_traits_t {
...
};
auto server = restinio::run_async<my_traits>(
restinio::own_io_context(),
restinio::server_settings_t<my_traits>{}
.address(...)
.port(...)
.request_handler(...),
// Use just one thread for the HTTP-server.
1u);
... // Some other actions.
}

run_async() returns control when HTTP-server is started or some startup failure is detected. But if a failure is detected then an exception is thrown. So if run_async() returns successfuly then HTTP-server is working.

The started HTTP-server will be automatically stopped at the destruction of the returned value. Because of that the returned value should be stored for the time while HTTP-server is needed.

The started HTTP-server can be stopped manually by calling stop() and wait() methods:

auto server = restinio::run_async(...);
...
server->stop(); // Returns without the waiting.
... // Some other actions.
server->wait(); // Returns only when HTTP-server stopped.

Since
  v.0.6.7

Definition at line 1112 of file http_server_run.hpp.

## sendfile() [1/4]

sendfile_t restinio::sendfile | ( | const char * | file_path,
|  | file_size_t | chunk_size = `sendfile_default_chunk_size`
| ) |  |

inline

Parameters

  file_path | Path to file.
  chunk_size | The max size of a data to be send on a single iteration.

Definition at line 481 of file sendfile.hpp.

## sendfile() [2/4]

sendfile_t restinio::sendfile | ( | const std::string & | file_path,
|  | file_size_t | chunk_size = `sendfile_default_chunk_size`
| ) |  |

inline

Parameters

  file_path | Path to file.
  chunk_size | The max size of a data to be send on a single iteration.

Definition at line 495 of file sendfile.hpp.

## sendfile() [3/4]

sendfile_t restinio::sendfile | ( | file_descriptor_holder_t | fd,
|  | file_meta_t | meta,
|  | file_size_t | chunk_size = `sendfile_default_chunk_size`
| ) |  |

inline noexcept

Parameters

  fd | Native file descriptor.
  meta | File meta data.
  chunk_size | The max size of a data to be send on a single iteration.

Definition at line 469 of file sendfile.hpp.

## sendfile() [4/4]

sendfile_t restinio::sendfile | ( | string_view_t | file_path,
|  | file_size_t | chunk_size = `sendfile_default_chunk_size`
| ) |  |

inline

Parameters

  file_path | Path to file.
  chunk_size | The max size of a data to be send on a single iteration.

Definition at line 505 of file sendfile.hpp.

## skip_break_signal_handling()

constexpr break_signal_handling_t restinio::skip_break_signal_handling | ( |  | ) |

inline constexpr noexcept

Make the indicator for absence of break signal handler.

Usage example:

restinio::run( restinio::on_thread_pool(
std::thread::hardware_concurrency(),
restinio::skip_break_signal_handling(),
my_server) );

Since
  v.0.5.1

Definition at line 69 of file http_server_run.hpp.

## static_if_else()

template<bool Condition, typename If_Part , typename Else_Part >

decltype(auto) restinio::static_if_else | ( | If_Part && | if_part,
|  | Else_Part && | else_part
| ) |  |

An emulation of if constexpr for C++14.

Usage example:

static_if_else< noexcept(some-expression) >(
[]() noexcept {
... // Some action that doesn't throw.
},
[] {
try {
... // Some action that throws.
}
catch(...) {}
});
restinio::static_if_else
decltype(auto) static_if_else(If_Part &&if_part, Else_Part &&else_part)
An emulation of if constexpr for C++14.
Definition: compiler_features.hpp:186

Since
  v.0.6.1.1

Definition at line 186 of file compiler_features.hpp.

## status_accepted()

http_status_line_t restinio::status_accepted | ( |  | ) |

inline

Definition at line 2182 of file http_headers.hpp.

## status_bad_gateway()

http_status_line_t restinio::status_bad_gateway | ( |  | ) |

inline

Definition at line 2278 of file http_headers.hpp.

## status_bad_request()

http_status_line_t restinio::status_bad_request | ( |  | ) |

inline

Examples
  sample/express_router/main.cpp, sample/extra_data_factory/main.cpp, and sample/try_parse_query_string/main.cpp.

Definition at line 2218 of file http_headers.hpp.

## status_conflict()

http_status_line_t restinio::status_conflict | ( |  | ) |

inline

Definition at line 2245 of file http_headers.hpp.

## status_continue()

http_status_line_t restinio::status_continue | ( |  | ) |

inline

Definition at line 2170 of file http_headers.hpp.

## status_created()

http_status_line_t restinio::status_created | ( |  | ) |

inline

Definition at line 2179 of file http_headers.hpp.

## status_expectation_failed()

http_status_line_t restinio::status_expectation_failed | ( |  | ) |

inline

Definition at line 2269 of file http_headers.hpp.

## status_failed_dependency()

http_status_line_t restinio::status_failed_dependency | ( |  | ) |

inline

Definition at line 2312 of file http_headers.hpp.

## status_forbidden()

http_status_line_t restinio::status_forbidden | ( |  | ) |

inline

Examples
  sample/sendfiles/main.cpp.

Definition at line 2227 of file http_headers.hpp.

## status_found()

http_status_line_t restinio::status_found | ( |  | ) |

inline

Definition at line 2203 of file http_headers.hpp.

## status_gateway_time_out()

http_status_line_t restinio::status_gateway_time_out | ( |  | ) |

inline

Definition at line 2284 of file http_headers.hpp.

## status_gone()

http_status_line_t restinio::status_gone | ( |  | ) |

inline

Definition at line 2248 of file http_headers.hpp.

## status_http_version_not_supported()

http_status_line_t restinio::status_http_version_not_supported | ( |  | ) |

inline

Definition at line 2287 of file http_headers.hpp.

## status_insufficient_storage()

http_status_line_t restinio::status_insufficient_storage | ( |  | ) |

inline

Definition at line 2315 of file http_headers.hpp.

## status_internal_server_error()

http_status_line_t restinio::status_internal_server_error | ( |  | ) |

inline

Definition at line 2272 of file http_headers.hpp.

## status_length_required()

http_status_line_t restinio::status_length_required | ( |  | ) |

inline

Definition at line 2251 of file http_headers.hpp.

## status_locked()

http_status_line_t restinio::status_locked | ( |  | ) |

inline

Definition at line 2309 of file http_headers.hpp.

## status_method_not_allowed()

http_status_line_t restinio::status_method_not_allowed | ( |  | ) |

inline

Examples
  sample/express_router/main.cpp.

Definition at line 2233 of file http_headers.hpp.

## status_moved_permanently()

http_status_line_t restinio::status_moved_permanently | ( |  | ) |

inline

Definition at line 2200 of file http_headers.hpp.

## status_multi_status()

http_status_line_t restinio::status_multi_status | ( |  | ) |

inline

Definition at line 2303 of file http_headers.hpp.

## status_multiple_choices()

http_status_line_t restinio::status_multiple_choices | ( |  | ) |

inline

Definition at line 2197 of file http_headers.hpp.

## status_network_authentication_required()

http_status_line_t restinio::status_network_authentication_required | ( |  | ) |

inline

Definition at line 2328 of file http_headers.hpp.

## status_no_content()

http_status_line_t restinio::status_no_content | ( |  | ) |

inline

Definition at line 2188 of file http_headers.hpp.

## status_non_authoritative_information()

http_status_line_t restinio::status_non_authoritative_information | ( |  | ) |

inline

Definition at line 2185 of file http_headers.hpp.

## status_not_acceptable()

http_status_line_t restinio::status_not_acceptable | ( |  | ) |

inline

Definition at line 2236 of file http_headers.hpp.

## status_not_found()

http_status_line_t restinio::status_not_found | ( |  | ) |

inline

Examples
  sample/express_router_tutorial/main.cpp, and sample/sendfiles/main.cpp.

Definition at line 2230 of file http_headers.hpp.

## status_not_implemented()

http_status_line_t restinio::status_not_implemented | ( |  | ) |

inline

Examples
  sample/sendfiles/main.cpp.

Definition at line 2275 of file http_headers.hpp.

## status_not_modified()

http_status_line_t restinio::status_not_modified | ( |  | ) |

inline

Definition at line 2209 of file http_headers.hpp.

## status_ok()

http_status_line_t restinio::status_ok | ( |  | ) |

inline

Definition at line 2176 of file http_headers.hpp.

## status_partial_content()

http_status_line_t restinio::status_partial_content | ( |  | ) |

inline

Definition at line 2194 of file http_headers.hpp.

## status_payload_too_large()

http_status_line_t restinio::status_payload_too_large | ( |  | ) |

inline

Definition at line 2257 of file http_headers.hpp.

## status_payment_required()

http_status_line_t restinio::status_payment_required | ( |  | ) |

inline

Definition at line 2224 of file http_headers.hpp.

## status_permanent_redirect()

http_status_line_t restinio::status_permanent_redirect | ( |  | ) |

inline

Definition at line 2296 of file http_headers.hpp.

## status_precondition_failed()

http_status_line_t restinio::status_precondition_failed | ( |  | ) |

inline

Definition at line 2254 of file http_headers.hpp.

## status_precondition_required()

http_status_line_t restinio::status_precondition_required | ( |  | ) |

inline

Definition at line 2319 of file http_headers.hpp.

## status_processing()

http_status_line_t restinio::status_processing | ( |  | ) |

inline

Definition at line 2300 of file http_headers.hpp.

## status_proxy_authentication_required()

http_status_line_t restinio::status_proxy_authentication_required | ( |  | ) |

inline

Definition at line 2239 of file http_headers.hpp.

## status_request_header_fields_too_large()

http_status_line_t restinio::status_request_header_fields_too_large | ( |  | ) |

inline

Definition at line 2325 of file http_headers.hpp.

## status_request_time_out()

http_status_line_t restinio::status_request_time_out | ( |  | ) |

inline

Definition at line 2242 of file http_headers.hpp.

## status_requested_range_not_satisfiable()

http_status_line_t restinio::status_requested_range_not_satisfiable | ( |  | ) |

inline

Definition at line 2266 of file http_headers.hpp.

## status_reset_content()

http_status_line_t restinio::status_reset_content | ( |  | ) |

inline

Definition at line 2191 of file http_headers.hpp.

## status_see_other()

http_status_line_t restinio::status_see_other | ( |  | ) |

inline

Definition at line 2206 of file http_headers.hpp.

## status_service_unavailable()

http_status_line_t restinio::status_service_unavailable | ( |  | ) |

inline

Definition at line 2281 of file http_headers.hpp.

## status_switching_protocols()

http_status_line_t restinio::status_switching_protocols | ( |  | ) |

inline

Definition at line 2173 of file http_headers.hpp.

## status_temporary_redirect()

http_status_line_t restinio::status_temporary_redirect | ( |  | ) |

inline

Definition at line 2215 of file http_headers.hpp.

## status_too_many_requests()

http_status_line_t restinio::status_too_many_requests | ( |  | ) |

inline

Definition at line 2322 of file http_headers.hpp.

## status_unauthorized()

http_status_line_t restinio::status_unauthorized | ( |  | ) |

inline

Examples
  sample/chained_handlers/main.cpp, and sample/extra_data_factory/main.cpp.

Definition at line 2221 of file http_headers.hpp.

## status_unprocessable_entity()

http_status_line_t restinio::status_unprocessable_entity | ( |  | ) |

inline

Definition at line 2306 of file http_headers.hpp.

## status_unsupported_media_type()

http_status_line_t restinio::status_unsupported_media_type | ( |  | ) |

inline

Definition at line 2263 of file http_headers.hpp.

## status_uri_too_long()

http_status_line_t restinio::status_uri_too_long | ( |  | ) |

inline

Definition at line 2260 of file http_headers.hpp.

## status_use_proxy()

http_status_line_t restinio::status_use_proxy | ( |  | ) |

inline

Definition at line 2212 of file http_headers.hpp.

## string_to_field()

http_field_t restinio::string_to_field | ( | string_view_t | field | ) |

inline noexcept

Helper function to get method string name.

Definition at line 251 of file http_headers.hpp.

## try_parse_query()

template<typename Parse_Traits >

RESTINIO_NODISCARD expected_t< query_string_params_t, parse_query_failure_t > restinio::try_parse_query | ( | string_view_t | original_query_string | ) |

Helper function for parsing query string.

Unlike parse_query() function the try_parse_query() doesn't throw if some unsupported character sequence is found.

Note
  Parsing traits should be specified explicitly.

Usage example:

auto result = restinio::try_parse_query<
restinio::parse_query_traits::javascript_compatible>("name=A*&flags=!");
if(!result) {
std::cerr << "Unable to parse query-string: " << result.error().description() << std::endl;
}
else {
const restinio::query_string_params_t & params = *result;
...
}
restinio::query_string_params_t
Parameters container for query strings parameters.
Definition: uri_helpers.hpp:43
restinio::try_parse_query
RESTINIO_NODISCARD expected_t< query_string_params_t, parse_query_failure_t > try_parse_query(string_view_t original_query_string)
Helper function for parsing query string.
Definition: uri_helpers.hpp:399
restinio::parse_query_traits::javascript_compatible
Traits for parsing a query string in JavaScript-compatible mode.
Definition: uri_helpers.hpp:266

Attention
  This function is not noexcept and can throw on other types of failures (like unability to allocate a memory).

Since
  v.0.6.5

Parameters

  original_query_string | Query part of the request target.

Examples
  sample/try_parse_query_string/main.cpp.

Definition at line 399 of file uri_helpers.hpp.

## use_break_signal_handling()

constexpr break_signal_handling_t restinio::use_break_signal_handling | ( |  | ) |

inline constexpr noexcept

Make the indicator for usage of break signal handler.

Usage example:

restinio::run( restinio::on_thread_pool(
std::thread::hardware_concurrency(),
restinio::use_break_signal_handling(),
my_server) );

Since
  v.0.5.1

Definition at line 50 of file http_server_run.hpp.

## value_or()

template<typename Value_Type , typename Parameter_Container >

std::enable_if< std::is_same< Parameter_Container, query_string_params_t >::value||std::is_same< Parameter_Container, router::route_params_t >::value, Value_Type >::type restinio::value_or | ( | const Parameter_Container & | params,
|  | string_view_t | key,
|  | Value_Type | default_value
| ) |  |

Get parameter value or a given default.

Get the value of a parameter specified by key if parameter exists. If parameter exists in params it is obtained as `string_view_t` object and casted to a necessary type and then returns. If params has no such parameters then the default_value is returned.

Since
  v.0.4.4

Definition at line 36 of file value_or.hpp.

## Variable Documentation

## sendfile_default_chunk_size

constexpr file_size_t restinio::sendfile_default_chunk_size = 1024 * 1024

constexpr

Default chunk size for sendfile operation.

Since
  v.0.4.3

Definition at line 47 of file sendfile.hpp.

## sendfile_max_chunk_size

constexpr file_size_t restinio::sendfile_max_chunk_size = 1024 * 1024 * 1024

constexpr

Maximum size of a chunk.

Since
  v.0.4.3

Definition at line 51 of file sendfile.hpp.