All Versions
Latest Version
Avg Release Cycle
39 days
Latest Release
115 days ago

Changelog History
Page 1

  • v0.6.12

    November 10, 2020

    A new method incoming_http_msg_limits added to restinio::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) ); 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); 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.

  • v0.6.11

    October 22, 2020

    πŸ“œ Conversion functions passed to restinio::easy_parser::convert can now return expected_t<T, error_reason_t> as well as just T. Returning expected_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 of asio::ip::address (or boost::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 to asio::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 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();
  • v0.6.10

    August 20, 2020

    A TLS-context object can be passed to server_settings_t as a shared pointer. This makes it possible to use one TLS-context by several instances of RESTinio server, or TLS-context can be shared between a RESTinio server and other parts of an application.

    New example shared_tls_context added.

  • v0.6.9

    August 13, 2020

    Now RESTinio works with Asio 1.17. Version 0.6.9 can be used with Asio 1.12, 1.14, 1.16, and 1.17.

    Support for incoming requests with chunked encoding has been added. Previous versions of RESTinio didn’t support such requests, HTTP 501 error was returned. Since v.0.6.9 RESTinio accepts such requests and glues all chunks together into the one body. Information about an individual chunk is preserved and is available via request_t::chunked_input_info.

    πŸ‘ Since v.0.6.9 the value OFF for CMake-option RESTINIO_ALLOW_SOBJECTIZER is handled differently: all tests/examples/benchmarks those require SObjectizer as a dependency won't be compiled. All other tests/examples will be compiled as usual. There is also a new CMake-option RESTINIO_USE_EXTERNAL_SOBJECTIZER.

    New methods for http_header_fields_t class: remove_all_of and add_field.

    πŸ†• New helpers for parsing the following HTTP-fields: Connection, Host, Transfer-Encoding.

    πŸ“œ New tools for easy_parser and HTTP-field parsers: expected_token_p, expected_caseless_token_p, symbol_from_range_p, caseless_exact, caseless_exact_p.

    πŸ”Š There are also some thoughts about the future development of RESTinio.

  • v0.6.8

    May 15, 2020

    πŸ›  Implementation of extraction of Bearer authentification parameters fixed. Now it looks like:

    #include \<restinio/all.hpp\>#include \<restinio/http\_field\_parser/bearer\_auth.hpp\> on\_request(const restinio::request\_handle\_t & req) { using namespace restinio::http\_field\_parsers::bearer\_auth;const auto auth\_params = try\_extract\_params(\*req, restinio::http\_field::authorization); if(auth\_params) { // Parameters successfully extracted.if(is\_valid\_user(auth\_params-\>token)) { ... } } ... }

    πŸ“œ New helper function try_parse_field for simplification of HTTP-fields parsing added:

    #include \<restinio/all.hpp\>#include \<restinio/helpers/http\_fields\_parsers/try\_parse\_field.hpp\>#include \<restinio/helpers/http\_fields\_parsers/accept.hpp\> on\_request(const restinio::request\_handle\_t & req) { using namespace restinio::http\_field\_parsers;// Try to get and parse the value of `Accept` header.const auto parse\_result = try\_parse\_field\<accept\_value\_t\>( req, restinio::http\_field::accept); if(const auto \* value = restinio::get\_if\<accept\_value\_t\>(&parse\_result)) { // Value of the field is successfully parsed. ... // Some usage of parsed value. } }

    Several new overloads for try_extract_params functions from restinio::http_field_parsers::basic_auth and restinio::http_field_parsers::bearer_auth namespaces. They allow to work with several authentication schemes after the parsing of Authorization (Proxy-Authorization) field:

    auto on\_request(const restinio::request\_handle\_t & req) { using namespace restinio::http\_field\_parsers;const auto field = try\_parse\_field\<authorization\_value\_t\>( req, restinio::http\_field::authorization); if(const auto \* auth = restinio::get\_if\<authorization\_value\_t\>(field)) { // We have valid Authorization field value.if("basic" == auth-\>auth\_scheme) { // Basic authentification scheme should be used.using namespace restinio::http\_field\_parsers::basic\_auth;const auto params = try\_extract\_params(auth-\>auth\_params); if(params) { // Parameters successfully extracted.if(is\_valid\_user(params-\>username, params-\>password)) { ... } } ... } else if("bearer" == auth-\>auth\_scheme) { // Bearer authentification scheme should be used.using namespace restinio::http\_field\_parsers::bearer\_auth;const auto params = try\_extract\_params(auth-\>auth\_params); if(auth\_params) { // Parameters successfully extracted.if(is\_valid\_user(auth\_params-\>token)) { ... } } ... } else { ... // Handling of different schemes. } } }
  • v0.6.8.1

    June 24, 2020

    πŸš€ This is a bug-fix release.

    πŸ›  Issue #105 fixed.

    ⚠ Several warnings detected by GCC compilers are fixed.

  • v0.6.7

    May 11, 2020


    πŸ†• New helper function run_async that allows to run an instance of RESTinio's server on a separate thread-pool or thread:

    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("") .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.}

    πŸ†• New helpers for working with HTTP-fields like Authorization and Proxy-Authorization, and helpers for the extraction of parameters for Basic authentication:

    #include \<restinio/all.hpp\>#include \<restinio/http\_field\_parser/basic\_auth.hpp\> on\_request(const restinio::request\_handle\_t & req) { using namespace restinio::http\_field\_parsers::basic\_auth;const auto auth\_params = try\_extract\_params(\*req, restinio::http\_field::authorization); if(auth\_params) { // Parameters successfully extracted.if(is\_valid\_user(auth\_params-\>username, auth\_params-\>password)) { ... } } ... }

    πŸ›  Some bug fixes.

  • v0.6.7.1

    May 12, 2020

    πŸ†• New helpers for extraction of parameters for Bearer authentication (thanks to @prince-chrismc):

    #include \<restinio/all.hpp\>#include \<restinio/http\_field\_parser/bearer\_auth.hpp\> on\_request(const restinio::request\_handle\_t & req) { using namespace restinio::http\_field\_parsers::bearer\_auth;const auto auth\_params = try\_extract\_params(\*req, restinio::http\_field::authorization); if(auth\_params) { // Parameters successfully extracted.if(is\_valid\_user(auth\_params-\>client\_id, auth\_params-\>client\_secret)) { ... } } ... }
  • v0.6.6

    April 13, 2020

    An experimental type-safe request-router that can be used as a type-safe alternative of express-like router with additional compile-time checking. That new easy_parser_router allows to write:

    namespace epr = restinio::router::easy\_parser\_router; router-\>http\_get( epr::path\_to\_params("/api/v1/posts/", epr::non\_negative\_decimal\_number\_p\<std::uint64\_t\>(), "/revisions/", epr::non\_negative\_decimal\_number\_p\<std::int16\_t\>()), [](const auto & req, std::uint64\_t post\_id, std::int16\_t rev\_id) {...});

    instead of:

    router-\>http\_get("/api/v1/posts/:post\_id(\d{1,10})/revisions/:rev\_id(\d{1,5})", [](const auto & req, const auto & params) { const auto post\_id = restinio::cast\_to\<std::uint64\_t\>(params["post\_id"]); const auto rev\_id = restinio::cast\_to\<std::int16\_t\>(params["rev\_id"]); });

    πŸ‘€ An ability to specify a request handler for several HTTP-methods (see #82 for a motivation). It's possible now to write routes like:

    router-\>add\_handler( restinio::router::any\_of\_methods( restinio::http\_method\_lock(), restinio::http\_method\_unlock()), "/api/v1/resources/:rid", [](const auto & req, const auto & params) {...}); router-\>add\_handler( restinio::router::none\_of\_methods( restinio::http\_method\_get(), restinio::http\_method\_post(), restinio::http\_method\_delete()), "/api/v1/users/:user", [](const auto & req, const auto & params) {...});

    Those new method matchers can be used for express-like or easy_parser-based routers.

    New RESTINIO_FMT_HEADER_ONLY CMake option added. It allows to use the compiled version of fmtlib with RESTinio. Thanks for @prince-chrismc for a patch.

  • v0.6.5

    February 25, 2020

    Set of symbols supported by restinio::parse_query_traits::javascript_compatible is extended (#76).

    Addition of restinio::parse_query_traits::x_www_form_urlencoded, restinio::parse_query_traits::relaxed trais.

    πŸ“œ Introduction of try_parse_query function.

    Some functions that work with query-string and URI (like parse_query, try_parse_query) now do basic control of the validity of UTF-8 sequences represented as percent-encoded characters.

    πŸ‘‰ New RESTINIO_USE_EXTERNAL_HTTP_PARSER option for CMake-based builds.