RESTinio v0.6.12 Release Notes
Release Date: 2020-11-10 // almost 4 years ago-
A new method
incoming_http_msg_limits
added torestinio::server_settings_t
. This method allows to set up limits for the maximum length of various parts of an incoming HTTP message (like URL, HTTP-field’s name and value):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());
A possibility to limit the number of parallel connection has been added:
struct my\_traits : public restinio::default\_traits\_t { // Force the usage of connection count limiter.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());
👍 A support for SObjectizer 5.6/5.7 has been added. Now RESTinio can be user either with SObjectizer 5.5 and SObjectizer 5.6/5.7. The version of SObjectizer is detected automatically. But if a user wants to use SObjectizer 5.6/5.7 he/she should set C++ standard to C++17 manually.
Previous changes from v0.6.11
-
📜 Conversion functions passed to
restinio::easy_parser::convert
can now returnexpected_t<T, error_reason_t>
as well as justT
. Returningexpected_t<T, error_reason_t>
allows to report conversion errors without throwing an exception. This is a fix for #99.A new overload for
restinio::server_settings_t::address()
method. The new overload accepts an instance ofasio::ip::address
(orboost::asio::ip::address
). This is a fix for #100.A new optional post-bind hook added. This hook is called just after a succesful return from
bind()
for server’s acceptor. A reference toasio::ip::tcp::acceptor
is passed to that hook. This new hook can be used for application-specific tuning of bound acceptor or to gathering some information about the acceptor. This is a fix for #126. For example, this code snippet shows how RESTinio server can be started on a random port assigned by the Operating System:std::promise\<unsigned short\> port\_promise; // For getting the port.auto server = restinio::run\_async( restinio::use\_own\_context(), restinio::server\_settings\_t{} .address("localhost") .port(0u) // Zero means that port will be assigned by the OS. .acceptor\_post\_bind\_hook( [&port\_promise](asio::ip::tcp::acceptor & acceptor) { // Gathering the actual port number. port\_promise.set\_value(acceptor.local\_endpoint().port()); }) .request\_handler(...), 4u);// Now we can safely get the actual port number from the promise.const auto actual\_port = port\_promise.get\_future().get();