This project is a C++ application demonstrating an asynchronous HTTP client built using libcurl. It provides a simple framework for making non-blocking HTTP requests.
- Asynchronous GET and POST requests.
- Streaming request and response bodies.
- Modern C++ (C++23) implementation.
- Dependency management with Conan.
- Building with CMake.
- C++23 compatible compiler (e.g., GCC, Clang)
- CMake (version 3.10+)
- Conan
-
Install Dependencies: Ensure you have CMake and Conan installed on your system. The C++ dependencies (absl, gtest, libcurl) will be fetched by Conan.
-
Configure and Build: Use the following commands to configure the project with Conan and build it with CMake:
mkdir -p build cd build conan install .. --build=missing cmake .. -DCMAKE_TOOLCHAIN_FILE=build/Release/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release cmake --build .
The project builds two main executables: download and upload.
The download executable performs a GET request to a specified URL.
./build/bin/download --url <URL>Example:
./build/bin/download --url https://www.google.comThe upload executable performs a POST request, streaming a generated body to the target URL.
./build/bin/upload --url <URL>Example:
./build/bin/upload --url https://httpbin.org/postThe project includes unit tests using GoogleTest. To run the tests, execute the following command from the build directory:
ctestDespite the help of Gemini-cli, this project is carefully designed and written by human. But I highly recommend you to try it out.