HTTPS SSH

This repository contains examples of different ways of integration async processing of incoming HTTP-requests with help of RESTinio and async processing of outgoing HTTP-requests with help of libcurl.

How To Obtain And Try?

Prerequisites

A C++ complier with more or less good support of C++14. We have tried gcc-5.4, 7.2 and 7.3, clang-3.8, 3.9 and 5.0.

Linux or FreeBSD (may be macOS). We don't check these examples on Windows. Maybe some of them will work on Windows, except bridge_server_1_pipe, because it uses Unix-pipe.

You also need an installed libcurl (it means you should have all necessary header files and .a/.so files). All other dependencies are complied by examples itself.

How To Obtain?

This repository contains only source codes of the examples. Sources of dependencies (like Asio, fmtlib, restinio and so on) are not included into the repository. There are two ways to get the examples and all necessary dependencies.

Download The Full Archive

There is a Download section. It contains archives with all source codes (it means that an archive contains sources of the examples and sources of all necessary subprojects, except libcurl). The simpliest way is to download a corresponding archive, unpack it, go into async_restinio_async_libcurl_en/dev, then compile and run.

Use MxxRu::externals

It this case you need to have Ruby + MxxRu + various utilities which every Linux/FreeBSD-developer usually have (like git, tar, unzip and stuff like that). Then:

  1. Install Ruby and RubyGems (usually RubyGems is installed with Ruby but sometimes you have to install it separatelly).
  2. Install MxxRu: gem install Mxx_ru
  3. Do hg clone: hg clone https://bitbucket.org/sobjectizerteam/async_restinio_async_libcurl_en
  4. Go into appropriate folder: cd async_restinio_async_libcurl_en
  5. Run command mxxruexternals
  6. Wait while add dependencies will be downloaded.

Then go to dev subfolder, compile and run.

How To Try?

Building With CMake

A well known chain of actions:

cd async_restinio_async_libcurl_en/dev
mkdir cmake_build
cd cmake_build
cmake -DCMAKE_INSTALL_PREFIX=target -DCMAKE_BUILD_TYPE=release ..
cmake --build . --config Release
cmake --build . --target install

Then go to target/bin and run appropriate executable files.

Building With MxxRu

The following chain of actions is necessary for building with MxxRu:

cd async_restinio_async_libcurl_en/dev
ruby build.rb

All results of build process can be found in subfolders of target folder. For example in subfolder like target/gcc_7_3_0__x86_64_pc_linux_gnu.

Launching The Apps

NOTE: every example application accepts --help argument. Just launch an application with -h or --help key and see the brief explanation.

To launch example application just go to the appropriate folder (it can be cmake_build/target/bin when building with CMake or it can be target/gcc_7_3_0__x86_64_pc_linux_gnu/release when building with MxxRu). Then run delay_server app:

./delay_server

And then any of bridge_server applications:

./bridge_server_1

A bridge_server app listens on localhost:8080 by default (and delay_server listens on localhost:8090). Only IPv4 is used.

A test request can looks like:

curl -4 "http://localhost:8080/data?year=2018&month=03&day=05"

A heavy load can be made by using ApacheBench utility:

ab -n 50000 -c 200 "http://localhost:8080/data?year=2018&month=03&day=05"