A lightweight C++ HTTP library for creating and handling HTTP requests and responses.
Note
The library only works on POSIX-compliant systems.
- Create and handle HTTP requests and responses (can be used as both an HTTP server and an HTTP client)
- Uses bokshi-gh/http-codec library to encode and decode HTTP requests and responses
- Includes nlohmann/json for parsing and serializing JSON data
- Includes bokshi-gh/dotenv-cpp utility for loading environment variables directly from a file
-
Install via the installer script:
curl -fsSL https://raw.githubusercontent.com/bokshi-gh/http-library/main/scripts/install.sh | sudo bash
You can check the source code of the installer script here.
-
Example code demonstrating how to use the library is available in
examples/http_library_server_demo.cppandexamples/http_library_client_demo.cpp -
Include the header in your C++ project:
#include <bokshi/http_library.hpp>
-
Link the library when compiling your project:
-
If you need server, compile like:
g++ main.cpp -lhttp_library -pthread -o my_server
-
If you only need client, compile like:
g++ main.cpp -lhttp_library -o my_client
-
-
Remove the installed headers and library files from the system:
sudo rm -f /usr/local/include/bokshi/ sudo rm -f /usr/local/lib/libhttp_library.a sudo ldconfig
This project is licensed under the GPL-3.0 license.