RESTinio 0.4.8 Released!

2018.08.21

We added more useful features and plenty of improvements.

What's new:

  • Add notificators for tracking status of a written response data. So one can track the status of a write operation. Sample notificator usage:
    int main()
    {
      restinio::run(
        restinio::on_this_thread<>()
          .port(8080)
          .address("localhost")
          .request_handler([](auto req) {
            return req->create_response()
                     .set_body("Hello, World!")
                     .done( [](const auto & ec ){
                       std::cout << "Sending response status: " << ec << std::endl;
                     });
          }));
    
      return 0;
    }
    
  • Add support for arbitrary datasizeable types as buffers. RESTinio supports any arbitrary type T as a buffer if it fills the following contract:
    - T must have const member function data() returning a pointer to the begining of the buffer data.
    - T must have const member function size() returning a size of a buffer in bytes.
    - T must be move constructible.
    // Blob for image, wraps a Image magick Blob
    // that is already a smart pointer.
    struct datasizable_blob_t
    {
      // Datasizeable interface:
      const void * data() const noexcept { return m_blob.data(); }
      std::size_t size() const noexcept { return m_blob.length(); }
    
      //! Image data blob.
      Magick::Blob m_blob;
    };
    
    // Somewhere in handler:
    datasizable_blob_t body;
    image.write( &(body.m_blob) ); // Writes image binary data to blob.
    resp.set_body( body );
  • Add trace messages for response status line:
    [2018-08-20 21:46:58.482] TRACE: [connection:1] start connection with 127.0.0.1:53908
    [2018-08-20 21:46:58.482] TRACE: [connection:1] start waiting for request
    [2018-08-20 21:46:58.482] TRACE: [connection:1] continue reading request
    [2018-08-20 21:46:58.482] TRACE: [connection:1] received 78 bytes
    [2018-08-20 21:46:58.482] TRACE: [connection:1] request received (#0): GET /
    [2018-08-20 21:46:58.482] TRACE: [connection:1] append response (#0), flags: { final_parts, connection_keepalive }, write group size: 2
    [2018-08-20 21:46:58.482] TRACE: [connection:1] start next write group for response (#0), size: 2
    [2018-08-20 21:46:58.482] TRACE: [connection:1] start response (#0): HTTP/1.1 200 OK
    [2018-08-20 21:46:58.482] TRACE: [connection:1] sending resp data, buf count: 2, total size: 192
    
  • Improve response builders interfaces with rvalue qualified versions of setters.

RESTinio is hosted on bitbucket (github mirror).

Archive is available in download section.

Documentation with helpful information is here.

Doxygen documentation is also available: RESTinio-0.4 API Reference.

If you miss something in RESTinio and want to see some new features let us know via info@stiffstream.com.