madmongo1 / blog-new-year-2021

Connection Caching HTTP
Boost Software License 1.0
13 stars 5 forks source link

An easy to use C++ Boost-based HTTP library with connection pool inside

Yes you read this right, Boost finally got internal wget/curl (almost)!

But better read an article from Boost.Beast maintainer - Richard Hodges. Basically this repository just packs his code into a library.

Requirements

Build

Regular cmake build:

mkdir build; cd build; cmake .. && cmake --build . -j 8

If you need just library and no demo tools pass -DBUILD_TOOLS=OFF to cmake.

Install

cmake --install . # from the build directory

It will install static library and tools.

Usage

http::connection_cache cache(co_await net::this_coro::executor);
auto result = co_await cache.call(http::verb::get, "https://yourwebhost.com");
std::cout << result->body();
// don't forget to catch exceptions