Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications.

Overview

Restbed Unix Build Status Windows Build Status


Restbed is a comprehensive and consistent programming model for building applications that require seamless and secure communication over HTTP, with the ability to model a range of business processes, designed to target mobile, tablet, desktop and embedded production environments.

It's akin to embedding NGINX into your companies own product line. -- Solutions Architect, Bellrock Technology

Features

Feature Description
WebSockets Full-duplex communication channels over a single TCP connection.
Server-Sent Events Server-Sent Events enables efficient server-to-client streaming of text-based event data—e.g., real-time notifications or updates generated on the server.
Comet Long polling model to allow long-held HTTP requests for pushing data from the server to client.
SSL/TLS Secure over the wire communication allowing you to transmit private data online.
Session Management Create custom HTTP session persistence and management logic.
HTTP Pipelining A technique allowing multiple HTTP requests to be sent on a single TCP connection without waiting for the corresponding responses.
Path Parameters Annotate URIs with custom path parameters such as resource keys, revisions, etc...
Query Parameters Automated query parameter parsing.
Header Filters Filter incoming HTTP requests by headers.
Logging Customise how and where log entries are created.
Multi-Path Resources Give a resource multiple paths for improved readability.
Customisable Methods Add your own custom HTTP methods.
Compression Adaptability to address any form of compression GZip, Deflate, etc...
Encoding Adaptability to address any form of encoding UTF-32, ASCII, etc...
Rules Engine Reduce complexity by processing incoming requests with readable units of code.
HTTP/HTTPS Built in client capabilities with optional SSL peer certificate verification. Deprecated
IPv4/IPv6 Internet Protocol Version 4/6 Network Support.
Architecture Asynchronous single or multi-threaded architecture, capable of addressing the C10K problem.
Converters Built-in Path, Query, and Header conversions for primary data-types.
Authentication Separate Service and/or Resource level authentication.
Error Handling Separate Service and/or Resource level error handling.
Address Binding Bind HTTP and/or HTTPS services to separate IP addresses.
Signal Handling Capture OS generated process signals.
Documentation High-quality documentation covering the architecture and API.
Compliance Flexibility to address HTTP 1.0/1.1+ compliance.
Mature Secure, Stable, and extensively tested since 2013.
Community Active, vibrant and energetic open source community.
Support Commercial support is available from Corvusoft.

Example

#include <memory>
#include <cstdlib>
#include <restbed>

using namespace std;
using namespace restbed;

void post_method_handler( const shared_ptr< Session > session )
{
    const auto request = session->get_request( );

    int content_length = request->get_header( "Content-Length", 0 );

    session->fetch( content_length, [ ]( const shared_ptr< Session > session, const Bytes & body )
    {
        fprintf( stdout, "%.*s\n", ( int ) body.size( ), body.data( ) );
        session->close( OK, "Hello, World!", { { "Content-Length", "13" } } );
    } );
}

int main( const int, const char** )
{
    auto resource = make_shared< Resource >( );
    resource->set_path( "/resource" );
    resource->set_method_handler( "POST", post_method_handler );

    auto settings = make_shared< Settings >( );
    settings->set_port( 1984 );
    settings->set_default_header( "Connection", "close" );

    Service service;
    service.publish( resource );
    service.start( settings );

    return EXIT_SUCCESS;
}

More in-depth examples can be found here. To see Restbed used in anger, please visit Corvusoft's RestQ project.

License

© 2013-2020 Corvusoft Limited, United Kingdom. All rights reserved.

The Restbed framework is dual licensed; See LICENSE for full details.

Support

Please contact [email protected], for support and licensing options including bespoke software development, testing, design consultation, training, mentoring and code review.

Please submit all enhancements, proposals, and defects via the issue tracker; Alternatively ask a question on StackOverflow tagged #restbed.

Build

git clone --recursive https://github.com/corvusoft/restbed.git
mkdir restbed/build
cd restbed/build
cmake [-DBUILD_SSL=NO] [-DBUILD_TESTS=NO] ..
make install
make test

You will now find all required components installed in the distribution sub-folder.

Building with external libraries

If you wish to build with external libraries (OpenSSL, ASIO).

git clone https://github.com/corvusoft/restbed.git
mkdir restbed/build
cd restbed/build
cmake [-DBUILD_SSL=NO] [-DBUILD_TESTS=NO] ..
make install
make test

Windows Build Instructions

For Microsoft Visual Studio instructions please see feature #17.

Building restbed - Using vcpkg

You can download and install restbed using the vcpkg dependency manager:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install restbed

The restbed port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

Documentation

This codebase is intended to be as self documenting as possible. We have supplied many examples and test suites to help aid developers.

You can locate the latest design and API documentation here.

Minimum Requirements

Resource Requirement
Compiler C++14 compliant or above
OS BSD, Linux, Mac OSX, Windows, Raspbian

Road Map

Milestone Feature Status
0.0 Asynchronous HTTP Service complete
1.0 HTTP 1.0 Compliance complete
2.0 HTTP 1.1 Compliance complete
2.5 Secure Socket Layer complete
2.5 Simultaneous Network Ports (HTTP/HTTPS) complete
3.0 Rules Engine complete
3.5 Schedule Tasks on Service run-loop complete
3.5 Multi-Threaded service capability complete
3.5 Bind Service to specific Address complete
3.5 Session Management complete
4.0 HTTP Client complete
4.0 Signal Handling complete
4.5 API Documentation complete
4.5 Web Sockets complete
5.0 Client-side SSL certificates development
5.0 Resource Caching development
5.0 Runtime Modifications development
5.0 HTTP 2 compliance development
5.0 Refactor, Reduce, Reuse pending

Contact

Method Description
Twitter Tweet us your questions & feature requests.
[email protected] Support related queries.
[email protected] Sale related queries.
Comments
  • CMakeList.txt typos for ssl

    CMakeList.txt typos for ssl

    In the current master branch (4.8) there are typos in the CMakeList.txt:

    cmake -DBUILD_SSL=YES ..
    
    CMake Error at cmake/Findopenssl.cmake:22 (message):
      Failed to locate OpenSSL dependency.  see restbed/dependency/openssl
    Call Stack (most recent call first):
      CMakeLists.txt:60 (find_package)
    

    Fix:

    -- find_package( openssl REQUIRED ) ++ find_package( OpenSSL REQUIRED )

    When this is fixed there are a few other typos:

    cmake -DBUILD_SSL=YES ..
    
    
    crypto_LIBRARY_STATIC
        linked by target "restbed-static" in directory /srv/rest/restbed
    
    ssl_LIBRARY_STATIC
        linked by target "restbed-static" in directory /srv/rest/restbed
    

    Fix (several instances in the file):

    -- crypto_LIBRARY_STATIC ++ CRYPTO_LIBRARY_STATIC

    -- ssl_LIBRARY_STATIC ++ SSL_LIBRARY_STATIC

    opened by lilltiger 0
  • ask for help:: How to send the main body content multiple times?

    ask for help:: How to send the main body content multiple times?

    For example, if I want to send a file to the client, each time I call the read function, I will read 1024 bytes from the file. How to send it only once without using Bytes, but send it every read. Looking forward to your help.

    opened by gaowanlu 1
  • Example/HTTPS_SERVICE error

    Example/HTTPS_SERVICE error

    Hi, I used the vcpkg and installed the library of the restbed[openssl]. My OS is Windows 10 x64 and I use Visual Studio 2019 Community Edition. I compile (Debug, x86) the example/HTTPS_SERVICE and when I run it, I get an error with code 3. Could you tell me what I did wrong?

    opened by valendovsky 0
  • Only export restbed symbols when building as a shared library + fix MinGW build

    Only export restbed symbols when building as a shared library + fix MinGW build

    Fixes #531 by:

    • only exporting the restbed symbols when building restbed as a shared library. On Windows, when linking to a static restbed, you now need to add -DRESTBED_STATIC to the compiler.
    • When installing, also install the binary component of a shared library. This is the .dll on Windows.
    • Fix issues when building restbed using MinGW@Linux. In addition to gcc@Linux, I used this toolchain to verify the correct symbol visibility of restbed's users.

    Fixes https://github.com/Corvusoft/restbed/issues/496 too

    opened by madebr 0
  • Cannot buid a static Windows restbed library without export any symbol

    Cannot buid a static Windows restbed library without export any symbol

    On current master, you cannot build restbed without exporting any restbed symbol. This is because __declspec(dllimport) or __declspec(dllexport) is always prepended.

    https://github.com/Corvusoft/restbed/blob/0c99284fba4f37a89de24972e48b8154abc5dc75/source/corvusoft/restbed/request.hpp#L24-L32

    There is no path to avoid the __declspec or the __attribute__((visibility ("default"))).

    opened by madebr 0
  • MINSIGSTKSZ error during building

    MINSIGSTKSZ error during building

    in the installation phase called "Building CXX object test/unit/CMakeFiles/uri_unit_test_suite.dir/source/uri_suite.cpp.o" i have this error :

    In file included from /usr/include/signal.h:328,
                     from /home/mattia/Sviluppo/restbed/dependency/catch/single_include/catch2/catch.hpp:7955,
                     from /home/mattia/Sviluppo/restbed/test/unit/source/uri_suite.cpp:10:
    /home/mattia/Sviluppo/restbed/dependency/catch/single_include/catch2/catch.hpp:10735:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
    10735 |     static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
          |                                                          ^~~~~~~~~~~
    In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24:
    /usr/include/unistd.h:640:17: note: ‘long int sysconf(int)’ declared here
      640 | extern long int sysconf (int __name) __THROW;
          |                 ^~~~~~~
    /home/mattia/Sviluppo/restbed/dependency/catch/single_include/catch2/catch.hpp:10794:45: error: size of array ‘altStackMem’ is not an integral constant-expression
    10794 |     char FatalConditionHandler::altStackMem[sigStackSize] = {};
          |                                             ^~~~~~~~~~~~
    make[2]: *** [test/unit/CMakeFiles/uri_unit_test_suite.dir/build.make:76: test/unit/CMakeFiles/uri_unit_test_suite.dir/source/uri_suite.cpp.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:432: test/unit/CMakeFiles/uri_unit_test_suite.dir/all] Error 2
    make: *** [Makefile:146: all] Error 2
    

    can anyone help me? i'm using Ubuntu 22.04.1 LTS and gcc/g++ 12

    opened by mattiadido95 1
Releases(4.8)
Owner
Corvusoft
B2B Software/Hardware Development
Corvusoft
C++ application development framework, to help developers create and deploy applications quickly and simply

ULib - C++ library Travis CI: Coverity Scan: ULib is a highly optimized class framework for writing C++ applications. I wrote this framework as my too

stefano casazza 950 Dec 24, 2022
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.

Welcome! The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design

Microsoft 7.2k Jan 8, 2023
Embeddable Event-based Asynchronous Message/HTTP Server library for C/C++

libasyncd Embeddable Event-based Asynchronous Message/HTTP Server library for C/C++. What is libasyncd? Libasyncd is an embeddable event-driven asynch

Seungyoung 166 Dec 5, 2022
C++ Parallel Computing and Asynchronous Networking Engine

中文版入口 Sogou C++ Workflow As Sogou`s C++ server engine, Sogou C++ Workflow supports almost all back-end C++ online services of Sogou, including all sea

Sogou-inc 9.7k Dec 29, 2022
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.

Cutelyst - The Qt Web Framework A Web Framework built on top of Qt, using the simple and elegant approach of Catalyst (Perl) framework. Qt's meta obje

Cutelyst 809 Dec 19, 2022
TreeFrog Framework : High-speed C++ MVC Framework for Web Application

Small but Powerful and Efficient TreeFrog Framework is a high-speed and full-stack web application framework based on C++ and Qt, which supports HTTP

TreeFrog Framework 1.1k Dec 22, 2022
C library to create simple HTTP servers and Web Applications.

Onion http server library Travis status Coverity status Onion is a C library to create simple HTTP servers and Web Applications. master the developmen

David Moreno Montero 1.9k Dec 31, 2022
A Zig binding to the webview library. Make Zig applications with a nice HTML5 frontend a reality!

A Zig binding to the webview library. Make Zig applications with a nice HTML5 frontend a reality!

ZigLibs 52 Dec 29, 2022
Tntnet is a web application server for web applications written in C++.

Tntnet is a web application server for web applications written in C++.

Tommi Mäkitalo 73 Sep 26, 2022
Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)

Crow is C++ microframework for web. (inspired by Python Flask) #include "crow.h" int main() { crow::SimpleApp app; CROW_ROUTE(app, "/")([]()

Jaeseung Ha 7k Jan 8, 2023
Drogon: A C++14/17 based HTTP web application framework running on Linux/macOS/Unix/Windows

English | 简体中文 | 繁體中文 Overview Drogon is a C++14/17-based HTTP application framework. Drogon can be used to easily build various types of web applicat

An Tao 8.5k Dec 31, 2022
Your high performance web application C framework

facil.io is a C micro-framework for web applications. facil.io includes: A fast HTTP/1.1 and Websocket static file + application server. Support for c

Bo 1.7k Dec 29, 2022
🌱Light and powerful C++ web framework for highly scalable and resource-efficient web application. It's zero-dependency and easy-portable.

Oat++ News Hey, meet the new oatpp version 1.2.5! See the changelog for details. Check out the new oatpp ORM - read more here. Oat++ is a modern Web F

Oat++ 6k Jan 4, 2023
QDjango, a Qt-based C++ web framework

QDjango - a Qt-based C++ web framework Copyright (c) 2010-2015 Jeremy Lainé About QDjango is a web framework written in C++ and built on top of the Qt

Jeremy Lainé 249 Dec 22, 2022
The application framework for developer module of EdgeGallery platform

crane-framework crane-framework将可复用的计算和软件功能抽象成插件,APP开发者面向使用插件进行MEC APP开发。这样屏蔽了和MEC平台交互的细节,实现MCE APP和MEC平台的松耦合。而且插件框架基础能力可裁剪,按需提供最小的APP系统。 特性介绍 为了方便开发者

EdgeGallery 21 Aug 30, 2021
A http/websocket server framework on linux.

The framework is a Web-Server on unix based system. Without using any third-party libraries, the framework writes from unix system calls and standard C library functions.

xingyuuchen 17 Oct 15, 2022
This is a proof-of-concept of a modern C web-framework that compiles to WASM and is used for building user interfaces.

DanCing Web ?? ?? (DCW) Getting Started Dancing Web is now distributed with the Tarantella Package Manager — a tool I've made to simplify setup of pro

Danilo Chiarlone 3 Sep 11, 2021
CppCMS - High Performance C++ Web Framework

CppCMS - High Performance C++ Web Framework What is CppCMS? CppCMS is a Free High Performance Web Development Framework (not a CMS) aimed at Rapid Web

Artyom Beilis 375 Dec 25, 2022
A high performance, middleware oriented C++14 http web framework please use matt-42/lithium instead

A high performance, middleware oriented C++14 http web framework please use matt-42/lithium instead

Matthieu Garrigues 1.7k Dec 17, 2022