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.
Issues
  • make install encounter error

    make install encounter error

    [ 0%] Building CXX object CMakeFiles/restbed-static.dir/source/corvusoft/restbed/detail/http_impl.cpp.o

    In file included from /home2/wangzhe/docker_restful/resource/StringMatch/test/restbed/source/corvusoft/restbed/detail/http_impl.cpp:16:0: /home2/wangzhe/docker_restful/resource/StringMatch/test/restbed/source/corvusoft/restbed/request.hpp:101:43: error:‘std::enable_if_t’ is not been decleared

    my gcc version is 8.3.0

    opened by w904413245 0
  • build error on mingw

    build error on mingw

    the win32 option added to CMakeLists.txt is only for msvc that cause build fail with gcc on windows

    if ( WIN32 ) add_definitions( -DWIN_DLL_EXPORT ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251" ) endif ( )

    opened by mipac 3
  • project version

    project version

    The project version in the CMakeLists.txt is set to 4.7.0 in the current master and also in the 4.8 tag? Is this done by intention?

    opened by maggu2810 0
  • Cookie ?

    Cookie ?

    I think there has been a problem merging https://github.com/Corvusoft/restbed/pull/309 and was then forget to add an out of the box support to cookie.

    opened by RoyBellingan 3
  • Compile errors with -DDEBUG

    Compile errors with -DDEBUG

    Addresses the same problem as https://github.com/Corvusoft/restbed/issues/422

    Test file, main.cpp

    #include <restbed>
    
    using namespace std;
    
    int main(int argc, char **argv) {
    
        return 0;
    }
    

    Command line

    g++ -DDEBUG=1 main.cpp
    

    Output

    <command-line>: error: expected identifier before numeric constant
    <command-line>: error: expected ‘}’ before numeric constant
    In file included from /usr/include/restbed:10,
                     from main.cpp:1:
    /usr/include/corvusoft/restbed/logger.hpp:38:13: note: to match this ‘{’
       38 |             {
          |             ^
    <command-line>: error: expected unqualified-id before numeric constant
    In file included from /usr/include/restbed:10,
                     from main.cpp:1:
    /usr/include/corvusoft/restbed/logger.hpp:50:13: error: ‘virtual’ outside class declaration
       50 |             virtual void stop( void ) = 0;
          |             ^~~~~~~
    /usr/include/corvusoft/restbed/logger.hpp:50:26: error: function ‘void restbed::stop()’ is initialized like a variable
       50 |             virtual void stop( void ) = 0;
          |                          ^~~~
    /usr/include/corvusoft/restbed/logger.hpp:52:13: error: ‘virtual’ outside class declaration
       52 |             virtual void start( const std::shared_ptr< const Settings >& settings ) = 0;
          |             ^~~~~~~
    /usr/include/corvusoft/restbed/logger.hpp:52:26: error: function ‘void restbed::start(const std::shared_ptr<const restbed::Settings>&)’ is initialized like a variable
       52 |             virtual void start( const std::shared_ptr< const Settings >& settings ) = 0;
          |                          ^~~~~
    /usr/include/corvusoft/restbed/logger.hpp:54:37: error: ‘Level’ does not name a type
       54 |             virtual void log( const Level level, const char* format, ... ) = 0;
          |                                     ^~~~~
    /usr/include/corvusoft/restbed/logger.hpp:54:13: error: ‘virtual’ outside class declaration
       54 |             virtual void log( const Level level, const char* format, ... ) = 0;
          |             ^~~~~~~
    /usr/include/corvusoft/restbed/logger.hpp:54:26: error: function ‘void restbed::log(int, const char*, ...)’ is initialized like a variable
       54 |             virtual void log( const Level level, const char* format, ... ) = 0;
          |                          ^~~
    /usr/include/corvusoft/restbed/logger.hpp:56:57: error: ‘Level’ does not name a type
       56 |             virtual void log_if( bool expression, const Level level, const char* format, ... ) = 0;
          |                                                         ^~~~~
    /usr/include/corvusoft/restbed/logger.hpp:56:13: error: ‘virtual’ outside class declaration
       56 |             virtual void log_if( bool expression, const Level level, const char* format, ... ) = 0;
          |             ^~~~~~~
    /usr/include/corvusoft/restbed/logger.hpp:56:26: error: function ‘void restbed::log_if(bool, int, const char*, ...)’ is initialized like a variable
       56 |             virtual void log_if( bool expression, const Level level, const char* format, ... ) = 0;
          |                          ^~~~~~
    /usr/include/corvusoft/restbed/logger.hpp:66:9: error: expected unqualified-id before ‘protected’
       66 |         protected:
          |         ^~~~~~~~~
    /usr/include/corvusoft/restbed/logger.hpp:74:30: error: expected unqualified-id before ‘const’
       74 |             explicit Logger( const Logger& original ) = default;
          |                              ^~~~~
    /usr/include/corvusoft/restbed/logger.hpp:74:29: error: expected ‘)’ before ‘const’
       74 |             explicit Logger( const Logger& original ) = default;
          |                            ~^~~~~~
          |                             )
    /usr/include/corvusoft/restbed/logger.hpp:76:35: error: declaration of ‘~restbed::Logger’ as non-member
       76 |             virtual ~Logger( void ) = default;
          |                                   ^
    /usr/include/corvusoft/restbed/logger.hpp:85:21: error: ‘restbed::Logger& restbed::operator=(const restbed::Logger&)’ must be a nonstatic member function
       85 |             Logger& operator =( const Logger& value ) = default;
          |                     ^~~~~~~~
    /usr/include/corvusoft/restbed/logger.hpp:89:9: error: expected unqualified-id before ‘private’
       89 |         private:
          |         ^~~~~~~
    /usr/include/corvusoft/restbed/logger.hpp:106:1: error: expected declaration before ‘}’ token
      106 | }
          | ^
    

    I believe the problem is here

    namespace restbed
    {
        //Forward Declarations
        class Settings;
        
        class Logger
        {
            public:
                //Friends
                
                //Definitions
                enum Level : int
                {
                    INFO = 0000,
            --->    DEBUG = 1000,
                    FATAL = 2000,
                    ERROR = 3000,
                    WARNING = 4000,
                    SECURITY = 5000
                };
    ...
    

    Because same thing happens with

    g++ -DINFO=1 main.cpp
    g++ -DFATAL=1 main.cpp
    g++ -DERROR=1 main.cpp
    g++ -DWARNING=1 main.cpp
    g++ -DSECURITY=1 main.cpp
    
    opened by obucina 0
  • CMake build options BUILD_STATIC_LIBRARY, BUILD_SHARED_LIBRARY, and B…

    CMake build options BUILD_STATIC_LIBRARY, BUILD_SHARED_LIBRARY, and B…

    …UILD_DEVEL_PACKAGE added (default=ON)

    These three new CMake build options control what kind of libraries will be build and what contents will be put into the resulting package:

    • BUILD_STATIC_LIBRARY controls if a static restbed library should be build
    • BUILD_SHARED_LIBRARY controls if a shared restbed library should be build
    • BUILD_DEVEL_PACKAGE controls if a development package should be build, i.e. C++ header files included

    The default value for all three options is ON to provide backward-compatibility with older restbed versions which do not offer these build options yet.

    opened by axelsommerfeldt 1
  • cmake/Findasio.cmake and cmake/Findcatch.cmake adapted for usage with…

    cmake/Findasio.cmake and cmake/Findcatch.cmake adapted for usage with…

    … cross-compiling CMake toolchain files

    Both files have been modified so they are able to find the git submodules 'dependency/asio' resp. 'dependency/catch' even if a CMake toolchain file was used with a different CMAKE_SYSROOT than / (which is common for cross-compiling CMake toolchain files).

    See also: https://cmake.org/cmake/help/latest/variable/CMAKE_SYSROOT.html

    opened by axelsommerfeldt 0
  • Build issue:

    Build issue: "opensslconf.h" file not found

    Hello, I tried to build restbed as stated in the README file using CMake after recursively cloning it from github.

    The step make install returns the following issue:

    restbed/dependency/openssl/include/openssl/e_os2.h:13:11: fatal error: 'openssl/opensslconf.h' file not found

    I looked at the corresponding folder and found out that the opensslconf.h.in configuring-file was not translated into opensslconf.h for some reason. I am using macOS BigSur 11.5.2.

    Does somebody know how to deal with this issue?

    opened by nbommersbach 0
  • Failed when restbed has cross compiled for aarch64

    Failed when restbed has cross compiled for aarch64

    When I try to cross compile the restbed from x86_64 to aarch64, there is an error:

    restbed/source/corvusoft/restbed/uri.cpp:125:9: error: narrowing conversion of ‘-1’ from ‘int’ to ‘unsigned char’ [-Wnarrowing]
    

    And there is also a warning:

    restbed/source/corvusoft/restbed/uri.cpp:150:37: warning: comparison is always true due to limited range of data type [-Wtype-limits]
    150 |                   if ( c1 != -1 && c2 != -1 )
          |                                  ~~~^~~~~
    
    opened by Frodez 2
  • restbed client upload file

    restbed client upload file

    hi~ could give the restbed client upload file examples? thanks!

    opened by Uangski 0
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 936 Nov 26, 2021
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 6.6k Dec 4, 2021
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 163 Nov 17, 2021
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 6.4k Nov 30, 2021
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 721 Dec 7, 2021
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 977 Nov 29, 2021
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.8k Dec 2, 2021
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 21 Nov 15, 2021
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 6.6k Dec 5, 2021
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 6.5k Dec 6, 2021
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.5k Dec 2, 2021
🌱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++ 4.7k Dec 3, 2021
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é 231 Nov 26, 2021
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 12 Dec 7, 2021
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
Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications.

Restbed Restbed is a comprehensive and consistent programming model for building applications that require seamless and secure communication over HTTP

Corvusoft 1.6k Nov 29, 2021
Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications.

Restbed Restbed is a comprehensive and consistent programming model for building applications that require seamless and secure communication over HTTP

Corvusoft 1.4k Mar 8, 2021
Fast and easy C++ RESTful WebServices framework

ngrest ngrest is a simple C++ REST framework. It has small footprint, fast and very easy in use. ngrest allow you to deploy C++ RESTful webservices un

Dmitry 396 Nov 26, 2021
Machine Learning Framework for Operating Systems - Brings ML to Linux kernel

Machine Learning Framework for Operating Systems - Brings ML to Linux kernel

File systems and Storage Lab (FSL) 154 Dec 3, 2021
This repository contains toy ImPlot applications that demonstrate some of the library's functionality

ImPlot Demos This repository contains toy ImPlot applications that demonstrate some of the library's functionality.

Evan Pezent 27 Dec 3, 2021
A C++11 RESTful web server library

Served Overview Served is a C++ library for building high performance RESTful web servers. Served builds upon Boost.ASIO to provide a simple API for d

Meltwater 675 Nov 23, 2021
This software brings you the possibility to Read and Write the internal Flash of the Nordic nRF52 series with an ESP32

ESP32 nRF52 SWD flasher This software brings you the possibility to Read and Write the internal Flash of the Nordic nRF52 series with an ESP32 using t

null 84 Nov 29, 2021
MHPatches is a plugin that brings some of PS2 features of Manhunt to the PC.

MHPatches Intro MHPatches is a plugin that brings some of PS2 features of Manhunt to the PC. Requirements UAL (https://github.com/ThirteenAG/Ultimate-

Fire_Head 16 Oct 30, 2021
ORM for consuming RESTful APIs in C++

restful_mapper ORM for consuming RESTful APIs in C++ Introduction restful_mapper connects business objects and Representational State Transfer (REST)

Logan Raarup 73 Jun 1, 2021
A C++ async HTTP client library to use in asynchronous applications while communicating with REST services.

libashttp An asynchronous HTTP library using Boost.ASIO as the backend. This project is licensed under: Usage Here is a example usage which is taken f

Tolga Hoşgör 49 Sep 27, 2021
An asynchronous web framework for C++ built on top of Qt

!!! I can no longer maintain this project. If you're interessed, please contact me and I can move the projetct to you !!! Tufão - an asynchronous web

Vinícius dos Santos Oliveira 526 Nov 26, 2021
Enabling services on your device 52 Nov 28, 2021
Idle is an asynchronous and hot-reloadable C++ dynamic component framework

Idle is an asynchronous, hot-reloadable, and highly reactive dynamic component framework similar to OSGI that is: ?? Modular: Your program logic is en

Denis Blank 152 Nov 23, 2021