aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules0
-rw-r--r--CMakeLists.txt320
-rw-r--r--deps/cpp-httplib/.clang-format (renamed from .clang-format)0
-rw-r--r--deps/cpp-httplib/.github/workflows/test.yaml (renamed from .github/workflows/test.yaml)0
-rw-r--r--deps/cpp-httplib/.gitignore (renamed from .gitignore)0
-rw-r--r--deps/cpp-httplib/CMakeLists.txt309
-rw-r--r--deps/cpp-httplib/LICENSE (renamed from LICENSE)0
-rw-r--r--deps/cpp-httplib/README.md (renamed from README.md)0
-rw-r--r--deps/cpp-httplib/cmake/FindBrotli.cmake (renamed from cmake/FindBrotli.cmake)0
-rw-r--r--deps/cpp-httplib/example/Makefile (renamed from example/Makefile)0
-rw-r--r--deps/cpp-httplib/example/benchmark.cc (renamed from example/benchmark.cc)0
-rw-r--r--deps/cpp-httplib/example/ca-bundle.crt (renamed from example/ca-bundle.crt)0
-rw-r--r--deps/cpp-httplib/example/client.cc (renamed from example/client.cc)0
-rw-r--r--deps/cpp-httplib/example/client.vcxproj (renamed from example/client.vcxproj)0
-rw-r--r--deps/cpp-httplib/example/example.sln (renamed from example/example.sln)0
-rw-r--r--deps/cpp-httplib/example/hello.cc (renamed from example/hello.cc)0
-rw-r--r--deps/cpp-httplib/example/redirect.cc (renamed from example/redirect.cc)0
-rw-r--r--deps/cpp-httplib/example/server.cc (renamed from example/server.cc)0
-rw-r--r--deps/cpp-httplib/example/server.vcxproj (renamed from example/server.vcxproj)0
-rw-r--r--deps/cpp-httplib/example/simplecli.cc (renamed from example/simplecli.cc)0
-rw-r--r--deps/cpp-httplib/example/simplesvr.cc (renamed from example/simplesvr.cc)0
-rw-r--r--deps/cpp-httplib/example/ssecli.cc (renamed from example/ssecli.cc)0
-rw-r--r--deps/cpp-httplib/example/ssesvr.cc (renamed from example/ssesvr.cc)0
-rw-r--r--deps/cpp-httplib/example/upload.cc (renamed from example/upload.cc)0
-rw-r--r--deps/cpp-httplib/httplib.h (renamed from httplib.h)0
-rw-r--r--deps/cpp-httplib/httplibConfig.cmake.in (renamed from httplibConfig.cmake.in)0
-rw-r--r--deps/cpp-httplib/split.py (renamed from split.py)0
-rw-r--r--deps/cpp-httplib/test/Makefile (renamed from test/Makefile)0
-rw-r--r--deps/cpp-httplib/test/Makefile.fuzz_test (renamed from test/Makefile.fuzz_test)0
-rw-r--r--deps/cpp-httplib/test/ca-bundle.crt (renamed from test/ca-bundle.crt)0
-rw-r--r--deps/cpp-httplib/test/fuzzing/Makefile (renamed from test/fuzzing/Makefile)0
-rw-r--r--deps/cpp-httplib/test/fuzzing/corpus/1 (renamed from test/fuzzing/corpus/1)0
-rw-r--r--deps/cpp-httplib/test/fuzzing/corpus/2 (renamed from test/fuzzing/corpus/2)0
-rw-r--r--deps/cpp-httplib/test/fuzzing/server_fuzzer.cc (renamed from test/fuzzing/server_fuzzer.cc)0
-rw-r--r--deps/cpp-httplib/test/fuzzing/server_fuzzer.dict (renamed from test/fuzzing/server_fuzzer.dict)0
-rw-r--r--deps/cpp-httplib/test/fuzzing/standalone_fuzz_target_runner.cpp (renamed from test/fuzzing/standalone_fuzz_target_runner.cpp)0
-rw-r--r--deps/cpp-httplib/test/gtest/gtest-all.cc (renamed from test/gtest/gtest-all.cc)0
-rw-r--r--deps/cpp-httplib/test/gtest/gtest.h (renamed from test/gtest/gtest.h)0
-rw-r--r--deps/cpp-httplib/test/gtest/gtest_main.cc (renamed from test/gtest/gtest_main.cc)0
-rw-r--r--deps/cpp-httplib/test/image.jpg (renamed from test/image.jpg)bin33653 -> 33653 bytes
-rw-r--r--deps/cpp-httplib/test/proxy/Dockerfile (renamed from test/proxy/Dockerfile)0
-rw-r--r--deps/cpp-httplib/test/proxy/basic_passwd (renamed from test/proxy/basic_passwd)0
-rw-r--r--deps/cpp-httplib/test/proxy/basic_squid.conf (renamed from test/proxy/basic_squid.conf)0
-rw-r--r--deps/cpp-httplib/test/proxy/digest_passwd (renamed from test/proxy/digest_passwd)0
-rw-r--r--deps/cpp-httplib/test/proxy/digest_squid.conf (renamed from test/proxy/digest_squid.conf)0
-rw-r--r--deps/cpp-httplib/test/proxy/docker-compose.yml (renamed from test/proxy/docker-compose.yml)0
-rwxr-xr-xdeps/cpp-httplib/test/proxy/down.sh (renamed from test/proxy/down.sh)0
-rwxr-xr-xdeps/cpp-httplib/test/proxy/up.sh (renamed from test/proxy/up.sh)0
-rw-r--r--deps/cpp-httplib/test/test.cc (renamed from test/test.cc)0
-rw-r--r--deps/cpp-httplib/test/test.conf (renamed from test/test.conf)0
-rw-r--r--deps/cpp-httplib/test/test.rootCA.conf (renamed from test/test.rootCA.conf)0
-rw-r--r--deps/cpp-httplib/test/test.sln (renamed from test/test.sln)0
-rw-r--r--deps/cpp-httplib/test/test.vcxproj (renamed from test/test.vcxproj)0
-rw-r--r--deps/cpp-httplib/test/test_proxy.cc (renamed from test/test_proxy.cc)0
-rw-r--r--deps/cpp-httplib/test/www/dir/index.html (renamed from test/www/dir/index.html)0
-rw-r--r--deps/cpp-httplib/test/www/dir/test.abcde (renamed from test/www/dir/test.abcde)0
-rw-r--r--deps/cpp-httplib/test/www/dir/test.html (renamed from test/www/dir/test.html)0
-rw-r--r--deps/cpp-httplib/test/www2/dir/index.html (renamed from test/www2/dir/index.html)0
-rw-r--r--deps/cpp-httplib/test/www2/dir/test.html (renamed from test/www2/dir/test.html)0
-rw-r--r--deps/cpp-httplib/test/www3/dir/index.html (renamed from test/www3/dir/index.html)0
-rw-r--r--deps/cpp-httplib/test/www3/dir/test.html (renamed from test/www3/dir/test.html)0
-rw-r--r--src/main.cpp71
62 files changed, 400 insertions, 300 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.gitmodules
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9342c3..dc82f76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,309 +1,29 @@
-#[[
- Build options:
- * BUILD_SHARED_LIBS (default off) builds as a shared library (if HTTPLIB_COMPILE is ON)
- * HTTPLIB_USE_OPENSSL_IF_AVAILABLE (default on)
- * HTTPLIB_USE_ZLIB_IF_AVAILABLE (default on)
- * HTTPLIB_REQUIRE_OPENSSL (default off)
- * HTTPLIB_REQUIRE_ZLIB (default off)
- * HTTPLIB_USE_BROTLI_IF_AVAILABLE (default on)
- * HTTPLIB_REQUIRE_BROTLI (default off)
- * HTTPLIB_COMPILE (default off)
- * BROTLI_USE_STATIC_LIBS - tells Cmake to use the static Brotli libs (only works if you have them installed).
- * OPENSSL_USE_STATIC_LIBS - tells Cmake to use the static OpenSSL libs (only works if you have them installed).
+cmake_minimum_required(VERSION 2.8.9)
+project(cpp-web)
- -------------------------------------------------------------------------------
-
- After installation with Cmake, a find_package(httplib) is available.
- This creates a httplib::httplib target (if found).
- It can be linked like so:
-
- target_link_libraries(your_exe httplib::httplib)
-
- The following will build & install for later use.
-
- Linux/macOS:
-
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
- sudo cmake --build . --target install
-
- Windows:
-
- mkdir build
- cd build
- cmake ..
- runas /user:Administrator "cmake --build . --config Release --target install"
-
- -------------------------------------------------------------------------------
-
- These variables are available after you run find_package(httplib)
- * HTTPLIB_HEADER_PATH - this is the full path to the installed header (e.g. /usr/include/httplib.h).
- * HTTPLIB_IS_USING_OPENSSL - a bool for if OpenSSL support is enabled.
- * HTTPLIB_IS_USING_ZLIB - a bool for if ZLIB support is enabled.
- * HTTPLIB_IS_USING_BROTLI - a bool for if Brotli support is enabled.
- * HTTPLIB_IS_COMPILED - a bool for if the library is compiled, or otherwise header-only.
- * HTTPLIB_INCLUDE_DIR - the root path to httplib's header (e.g. /usr/include).
- * HTTPLIB_LIBRARY - the full path to the library if compiled (e.g. /usr/lib/libhttplib.so).
- * httplib_VERSION or HTTPLIB_VERSION - the project's version string.
- * HTTPLIB_FOUND - a bool for if the target was found.
-
- Want to use precompiled headers (Cmake feature since v3.16)?
- It's as simple as doing the following (before linking):
-
- target_precompile_headers(httplib::httplib INTERFACE "${HTTPLIB_HEADER_PATH}")
-
- -------------------------------------------------------------------------------
-
- FindPython3 requires Cmake v3.12
- ARCH_INDEPENDENT option of write_basic_package_version_file() requires Cmake v3.14
-]]
-cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
-
-# On systems without Git installed, there were errors since execute_process seemed to not throw an error without it?
-find_package(Git QUIET)
-if(Git_FOUND)
- # Gets the latest tag as a string like "v0.6.6"
- # Can silently fail if git isn't on the system
- execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
- OUTPUT_VARIABLE _raw_version_string
- ERROR_VARIABLE _git_tag_error
- )
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release ... FORCE)
endif()
-# execute_process can fail silenty, so check for an error
-# if there was an error, just use the user agent as a version
-if(_git_tag_error OR NOT Git_FOUND)
- message(WARNING "cpp-httplib failed to find the latest Git tag, falling back to using user agent as the version.")
- # Get the user agent and use it as a version
- # This gets the string with the user agent from the header.
- # This is so the maintainer doesn't actually need to update this manually.
- file(STRINGS httplib.h _raw_version_string REGEX "User\-Agent.*cpp\-httplib/([0-9]+\.?)+")
-endif()
-# Needed since git tags have "v" prefixing them.
-# Also used if the fallback to user agent string is being used.
-string(REGEX MATCH "([0-9]+\\.?)+" _httplib_version "${_raw_version_string}")
-
-project(httplib VERSION ${_httplib_version} LANGUAGES CXX)
-
-# Change as needed to set an OpenSSL minimum version.
-# This is used in the installed Cmake config file.
-set(_HTTPLIB_OPENSSL_MIN_VER "1.1.1")
+set(CMAKE_CXX_FLAGS "-Wall -Wextra")
+set(CMAKE_CXX_FLAGS_DEBUG "-g")
+set(CMAKE_CXX_FLAGS_RELEASE "-Os -fno-pic -fomit-frame-pointer -flto -fno-rtti -ffunction-sections -fdata-sections")
-# Allow for a build to require OpenSSL to pass, instead of just being optional
-option(HTTPLIB_REQUIRE_OPENSSL "Requires OpenSSL to be found & linked, or fails build." OFF)
-option(HTTPLIB_REQUIRE_ZLIB "Requires ZLIB to be found & linked, or fails build." OFF)
-# Allow for a build to casually enable OpenSSL/ZLIB support, but silenty continue if not found.
-# Make these options so their automatic use can be specifically disabled (as needed)
-option(HTTPLIB_USE_OPENSSL_IF_AVAILABLE "Uses OpenSSL (if available) to enable HTTPS support." ON)
-option(HTTPLIB_USE_ZLIB_IF_AVAILABLE "Uses ZLIB (if available) to enable Zlib compression support." ON)
-# Lets you compile the program as a regular library instead of header-only
-option(HTTPLIB_COMPILE "If ON, uses a Python script to split the header into a compilable header & source file (requires Python v3)." OFF)
-# Just setting this variable here for people building in-tree
-if(HTTPLIB_COMPILE)
- set(HTTPLIB_IS_COMPILED TRUE)
+set(CPP_HTTPLIB_SRCDIR "${PROJECT_SOURCE_DIR}/deps/cpp-httplib" CACHE STRING "Path to the cpp-httplib source directory.")
+if(NOT EXISTS "${CPP_HTTPLIB_SRCDIR}/httplib.h")
+ message(FATAL_ERROR "cpp-httplib missing")
endif()
-option(HTTPLIB_REQUIRE_BROTLI "Requires Brotli to be found & linked, or fails build." OFF)
-option(HTTPLIB_USE_BROTLI_IF_AVAILABLE "Uses Brotli (if available) to enable Brotli decompression support." ON)
-# Defaults to static library
-option(BUILD_SHARED_LIBS "Build the library as a shared library instead of static. Has no effect if using header-only." OFF)
-if (BUILD_SHARED_LIBS AND WIN32 AND HTTPLIB_COMPILE)
- # Necessary for Windows if building shared libs
- # See https://stackoverflow.com/a/40743080
- set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+set(INJA_SRCDIR "${PROJECT_SOURCE_DIR}/deps/inja" CACHE STRING "Path to the inja source directory.")
+if(NOT EXISTS "${INJA_SRCDIR}/single_include/inja/inja.hpp")
+ message(FATAL_ERROR "inja missing")
endif()
-# Threads needed for <thread> on some systems, and for <pthread.h> on Linux
-find_package(Threads REQUIRED)
-# Since Cmake v3.11, Crypto & SSL became optional when not specified as COMPONENTS.
-if(HTTPLIB_REQUIRE_OPENSSL)
- find_package(OpenSSL ${_HTTPLIB_OPENSSL_MIN_VER} COMPONENTS Crypto SSL REQUIRED)
-elseif(HTTPLIB_USE_OPENSSL_IF_AVAILABLE)
- find_package(OpenSSL ${_HTTPLIB_OPENSSL_MIN_VER} COMPONENTS Crypto SSL QUIET)
+include_directories(${CPP_HTTPLIB_SRCDIR} ${INJA_SRCDIR}/single_include ${INJA_SRCDIR}/third_party/include)
+file(GLOB SOURCES "src/*.cpp")
+add_executable(cpp-web ${SOURCES})
+#target_compile_definitions(cpp-web PUBLIC CPPHTTPLIB_THREAD_POOL_COUNT=4)
+if(CMAKE_BUILD_TYPE MATCHES Release)
+ set_target_properties(cpp-web PROPERTIES LINK_FLAGS "-no-pie -flto -Wl,--gc-sections -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none")
endif()
-# Just setting this variable here for people building in-tree
-if(OPENSSL_FOUND)
- set(HTTPLIB_IS_USING_OPENSSL TRUE)
-endif()
-
-if(HTTPLIB_REQUIRE_ZLIB)
- find_package(ZLIB REQUIRED)
-elseif(HTTPLIB_USE_ZLIB_IF_AVAILABLE)
- find_package(ZLIB QUIET)
-endif()
-# Just setting this variable here for people building in-tree
-# FindZLIB doesn't have a ZLIB_FOUND variable, so check the target.
-if(TARGET ZLIB::ZLIB)
- set(HTTPLIB_IS_USING_ZLIB TRUE)
-endif()
-
-# Adds our cmake folder to the search path for find_package
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-if(HTTPLIB_REQUIRE_BROTLI)
- find_package(Brotli COMPONENTS encoder decoder common REQUIRED)
-elseif(HTTPLIB_USE_BROTLI_IF_AVAILABLE)
- find_package(Brotli COMPONENTS encoder decoder common QUIET)
-endif()
-# Just setting this variable here for people building in-tree
-if(Brotli_FOUND)
- set(HTTPLIB_IS_USING_BROTLI TRUE)
-endif()
-
-# Used for default, common dirs that the end-user can change (if needed)
-# like CMAKE_INSTALL_INCLUDEDIR or CMAKE_INSTALL_DATADIR
-include(GNUInstallDirs)
-
-if(HTTPLIB_COMPILE)
- # Put the split script into the build dir
- configure_file(split.py "${CMAKE_CURRENT_BINARY_DIR}/split.py"
- COPYONLY
- )
- # Needs to be in the same dir as the python script
- configure_file(httplib.h "${CMAKE_CURRENT_BINARY_DIR}/httplib.h"
- COPYONLY
- )
-
- # Used outside of this if-else
- set(_INTERFACE_OR_PUBLIC PUBLIC)
- # Brings in the Python3_EXECUTABLE path we can use.
- find_package(Python3 REQUIRED)
- # Actually split the file
- # Keeps the output in the build dir to not pollute the main dir
- execute_process(COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/split.py"
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- ERROR_VARIABLE _httplib_split_error
- )
- if(_httplib_split_error)
- message(FATAL_ERROR "Failed when trying to split Cpp-httplib with the Python script.\n${_httplib_split_error}")
- endif()
-
- # split.py puts output in "out"
- set(_httplib_build_includedir "${CMAKE_CURRENT_BINARY_DIR}/out")
- # This will automatically be either static or shared based on the value of BUILD_SHARED_LIBS
- add_library(${PROJECT_NAME} "${_httplib_build_includedir}/httplib.cc")
- target_sources(${PROJECT_NAME}
- PUBLIC
- $<BUILD_INTERFACE:${_httplib_build_includedir}/httplib.h>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/httplib.h>
- )
-else()
- # This is for header-only.
- set(_INTERFACE_OR_PUBLIC INTERFACE)
- add_library(${PROJECT_NAME} INTERFACE)
- set(_httplib_build_includedir "${CMAKE_CURRENT_SOURCE_DIR}")
-endif()
-# Lets you address the target with httplib::httplib
-# Only useful if building in-tree, versus using it from an installation.
-add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
-
-# Might be missing some, but this list is somewhat comprehensive
-target_compile_features(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
- cxx_std_11
- cxx_nullptr
- cxx_lambdas
- cxx_override
- cxx_defaulted_functions
- cxx_attribute_deprecated
- cxx_auto_type
- cxx_decltype
- cxx_deleted_functions
- cxx_range_for
- cxx_sizeof_member
-)
-
-target_include_directories(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
- $<BUILD_INTERFACE:${_httplib_build_includedir}>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
-)
-
-# Always require threads
-target_link_libraries(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
- Threads::Threads
- # Needed for Windows libs on Mingw, as the pragma comment(lib, "xyz") aren't triggered.
- $<$<PLATFORM_ID:Windows>:ws2_32>
- $<$<PLATFORM_ID:Windows>:crypt32>
- $<$<PLATFORM_ID:Windows>:cryptui>
- # Can't put multiple targets in a single generator expression or it bugs out.
- $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:Brotli::common>
- $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:Brotli::encoder>
- $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:Brotli::decoder>
- $<$<BOOL:${HTTPLIB_IS_USING_ZLIB}>:ZLIB::ZLIB>
- $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:OpenSSL::SSL>
- $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:OpenSSL::Crypto>
-)
-
-# Set the definitions to enable optional features
-target_compile_definitions(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
- $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:CPPHTTPLIB_BROTLI_SUPPORT>
- $<$<BOOL:${HTTPLIB_IS_USING_ZLIB}>:CPPHTTPLIB_ZLIB_SUPPORT>
- $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:CPPHTTPLIB_OPENSSL_SUPPORT>
-)
-
-# Cmake's find_package search path is different based on the system
-# See https://cmake.org/cmake/help/latest/command/find_package.html for the list
-if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
- set(_TARGET_INSTALL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/cmake/${PROJECT_NAME}")
-else()
- # On Non-Windows, it should be /usr/lib/cmake/<name>/<name>Config.cmake
- # NOTE: This may or may not work for macOS...
- set(_TARGET_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
-endif()
-
-include(CMakePackageConfigHelpers)
-
-# Configures the meta-file httplibConfig.cmake.in to replace variables with paths/values/etc.
-configure_package_config_file("${PROJECT_NAME}Config.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
- INSTALL_DESTINATION "${_TARGET_INSTALL_CMAKEDIR}"
- # Passes the includedir install path
- PATH_VARS CMAKE_INSTALL_FULL_INCLUDEDIR
- # There aren't any components, so don't use the macro
- NO_CHECK_REQUIRED_COMPONENTS_MACRO
-)
-
-if(HTTPLIB_COMPILE)
- write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
- # Example: if you find_package(httplib 0.5.4)
- # then anything >= 0.5 and <= 1.0 is accepted
- COMPATIBILITY SameMajorVersion
- )
-else()
- write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
- # Example: if you find_package(httplib 0.5.4)
- # then anything >= 0.5 and <= 1.0 is accepted
- COMPATIBILITY SameMajorVersion
- # Tells Cmake that it's a header-only lib
- # Mildly useful for end-users :)
- ARCH_INDEPENDENT
- )
-endif()
-
-# Creates the export httplibTargets.cmake
-# This is strictly what holds compilation requirements
-# and linkage information (doesn't find deps though).
-install(TARGETS ${PROJECT_NAME}
- EXPORT httplibTargets
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
-)
-
-install(FILES "${_httplib_build_includedir}/httplib.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
-
-install(FILES
- "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
- "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
- # Install it so it can be used later by the httplibConfig.cmake file.
- # Put it in the same dir as our config file instead of a global path so we don't potentially stomp on other packages.
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindBrotli.cmake"
- DESTINATION ${_TARGET_INSTALL_CMAKEDIR}
-)
-
-# NOTE: This path changes depending on if it's on Windows or Linux
-install(EXPORT httplibTargets
- # Puts the targets into the httplib namespace
- # So this makes httplib::httplib linkable after doing find_package(httplib)
- NAMESPACE ${PROJECT_NAME}::
- DESTINATION ${_TARGET_INSTALL_CMAKEDIR}
-)
+target_link_libraries(cpp-web pthread)
diff --git a/.clang-format b/deps/cpp-httplib/.clang-format
index 37e8a2b..37e8a2b 100644
--- a/.clang-format
+++ b/deps/cpp-httplib/.clang-format
diff --git a/.github/workflows/test.yaml b/deps/cpp-httplib/.github/workflows/test.yaml
index 37d2fdf..37d2fdf 100644
--- a/.github/workflows/test.yaml
+++ b/deps/cpp-httplib/.github/workflows/test.yaml
diff --git a/.gitignore b/deps/cpp-httplib/.gitignore
index cb90f2a..cb90f2a 100644
--- a/.gitignore
+++ b/deps/cpp-httplib/.gitignore
diff --git a/deps/cpp-httplib/CMakeLists.txt b/deps/cpp-httplib/CMakeLists.txt
new file mode 100644
index 0000000..b9342c3
--- /dev/null
+++ b/deps/cpp-httplib/CMakeLists.txt
@@ -0,0 +1,309 @@
+#[[
+ Build options:
+ * BUILD_SHARED_LIBS (default off) builds as a shared library (if HTTPLIB_COMPILE is ON)
+ * HTTPLIB_USE_OPENSSL_IF_AVAILABLE (default on)
+ * HTTPLIB_USE_ZLIB_IF_AVAILABLE (default on)
+ * HTTPLIB_REQUIRE_OPENSSL (default off)
+ * HTTPLIB_REQUIRE_ZLIB (default off)
+ * HTTPLIB_USE_BROTLI_IF_AVAILABLE (default on)
+ * HTTPLIB_REQUIRE_BROTLI (default off)
+ * HTTPLIB_COMPILE (default off)
+ * BROTLI_USE_STATIC_LIBS - tells Cmake to use the static Brotli libs (only works if you have them installed).
+ * OPENSSL_USE_STATIC_LIBS - tells Cmake to use the static OpenSSL libs (only works if you have them installed).
+
+ -------------------------------------------------------------------------------
+
+ After installation with Cmake, a find_package(httplib) is available.
+ This creates a httplib::httplib target (if found).
+ It can be linked like so:
+
+ target_link_libraries(your_exe httplib::httplib)
+
+ The following will build & install for later use.
+
+ Linux/macOS:
+
+ mkdir -p build
+ cd build
+ cmake -DCMAKE_BUILD_TYPE=Release ..
+ sudo cmake --build . --target install
+
+ Windows:
+
+ mkdir build
+ cd build
+ cmake ..
+ runas /user:Administrator "cmake --build . --config Release --target install"
+
+ -------------------------------------------------------------------------------
+
+ These variables are available after you run find_package(httplib)
+ * HTTPLIB_HEADER_PATH - this is the full path to the installed header (e.g. /usr/include/httplib.h).
+ * HTTPLIB_IS_USING_OPENSSL - a bool for if OpenSSL support is enabled.
+ * HTTPLIB_IS_USING_ZLIB - a bool for if ZLIB support is enabled.
+ * HTTPLIB_IS_USING_BROTLI - a bool for if Brotli support is enabled.
+ * HTTPLIB_IS_COMPILED - a bool for if the library is compiled, or otherwise header-only.
+ * HTTPLIB_INCLUDE_DIR - the root path to httplib's header (e.g. /usr/include).
+ * HTTPLIB_LIBRARY - the full path to the library if compiled (e.g. /usr/lib/libhttplib.so).
+ * httplib_VERSION or HTTPLIB_VERSION - the project's version string.
+ * HTTPLIB_FOUND - a bool for if the target was found.
+
+ Want to use precompiled headers (Cmake feature since v3.16)?
+ It's as simple as doing the following (before linking):
+
+ target_precompile_headers(httplib::httplib INTERFACE "${HTTPLIB_HEADER_PATH}")
+
+ -------------------------------------------------------------------------------
+
+ FindPython3 requires Cmake v3.12
+ ARCH_INDEPENDENT option of write_basic_package_version_file() requires Cmake v3.14
+]]
+cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
+
+# On systems without Git installed, there were errors since execute_process seemed to not throw an error without it?
+find_package(Git QUIET)
+if(Git_FOUND)
+ # Gets the latest tag as a string like "v0.6.6"
+ # Can silently fail if git isn't on the system
+ execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ OUTPUT_VARIABLE _raw_version_string
+ ERROR_VARIABLE _git_tag_error
+ )
+endif()
+
+# execute_process can fail silenty, so check for an error
+# if there was an error, just use the user agent as a version
+if(_git_tag_error OR NOT Git_FOUND)
+ message(WARNING "cpp-httplib failed to find the latest Git tag, falling back to using user agent as the version.")
+ # Get the user agent and use it as a version
+ # This gets the string with the user agent from the header.
+ # This is so the maintainer doesn't actually need to update this manually.
+ file(STRINGS httplib.h _raw_version_string REGEX "User\-Agent.*cpp\-httplib/([0-9]+\.?)+")
+endif()
+# Needed since git tags have "v" prefixing them.
+# Also used if the fallback to user agent string is being used.
+string(REGEX MATCH "([0-9]+\\.?)+" _httplib_version "${_raw_version_string}")
+
+project(httplib VERSION ${_httplib_version} LANGUAGES CXX)
+
+# Change as needed to set an OpenSSL minimum version.
+# This is used in the installed Cmake config file.
+set(_HTTPLIB_OPENSSL_MIN_VER "1.1.1")
+
+# Allow for a build to require OpenSSL to pass, instead of just being optional
+option(HTTPLIB_REQUIRE_OPENSSL "Requires OpenSSL to be found & linked, or fails build." OFF)
+option(HTTPLIB_REQUIRE_ZLIB "Requires ZLIB to be found & linked, or fails build." OFF)
+# Allow for a build to casually enable OpenSSL/ZLIB support, but silenty continue if not found.
+# Make these options so their automatic use can be specifically disabled (as needed)
+option(HTTPLIB_USE_OPENSSL_IF_AVAILABLE "Uses OpenSSL (if available) to enable HTTPS support." ON)
+option(HTTPLIB_USE_ZLIB_IF_AVAILABLE "Uses ZLIB (if available) to enable Zlib compression support." ON)
+# Lets you compile the program as a regular library instead of header-only
+option(HTTPLIB_COMPILE "If ON, uses a Python script to split the header into a compilable header & source file (requires Python v3)." OFF)
+# Just setting this variable here for people building in-tree
+if(HTTPLIB_COMPILE)
+ set(HTTPLIB_IS_COMPILED TRUE)
+endif()
+
+option(HTTPLIB_REQUIRE_BROTLI "Requires Brotli to be found & linked, or fails build." OFF)
+option(HTTPLIB_USE_BROTLI_IF_AVAILABLE "Uses Brotli (if available) to enable Brotli decompression support." ON)
+# Defaults to static library
+option(BUILD_SHARED_LIBS "Build the library as a shared library instead of static. Has no effect if using header-only." OFF)
+if (BUILD_SHARED_LIBS AND WIN32 AND HTTPLIB_COMPILE)
+ # Necessary for Windows if building shared libs
+ # See https://stackoverflow.com/a/40743080
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+endif()
+
+# Threads needed for <thread> on some systems, and for <pthread.h> on Linux
+find_package(Threads REQUIRED)
+# Since Cmake v3.11, Crypto & SSL became optional when not specified as COMPONENTS.
+if(HTTPLIB_REQUIRE_OPENSSL)
+ find_package(OpenSSL ${_HTTPLIB_OPENSSL_MIN_VER} COMPONENTS Crypto SSL REQUIRED)
+elseif(HTTPLIB_USE_OPENSSL_IF_AVAILABLE)
+ find_package(OpenSSL ${_HTTPLIB_OPENSSL_MIN_VER} COMPONENTS Crypto SSL QUIET)
+endif()
+# Just setting this variable here for people building in-tree
+if(OPENSSL_FOUND)
+ set(HTTPLIB_IS_USING_OPENSSL TRUE)
+endif()
+
+if(HTTPLIB_REQUIRE_ZLIB)
+ find_package(ZLIB REQUIRED)
+elseif(HTTPLIB_USE_ZLIB_IF_AVAILABLE)
+ find_package(ZLIB QUIET)
+endif()
+# Just setting this variable here for people building in-tree
+# FindZLIB doesn't have a ZLIB_FOUND variable, so check the target.
+if(TARGET ZLIB::ZLIB)
+ set(HTTPLIB_IS_USING_ZLIB TRUE)
+endif()
+
+# Adds our cmake folder to the search path for find_package
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+if(HTTPLIB_REQUIRE_BROTLI)
+ find_package(Brotli COMPONENTS encoder decoder common REQUIRED)
+elseif(HTTPLIB_USE_BROTLI_IF_AVAILABLE)
+ find_package(Brotli COMPONENTS encoder decoder common QUIET)
+endif()
+# Just setting this variable here for people building in-tree
+if(Brotli_FOUND)
+ set(HTTPLIB_IS_USING_BROTLI TRUE)
+endif()
+
+# Used for default, common dirs that the end-user can change (if needed)
+# like CMAKE_INSTALL_INCLUDEDIR or CMAKE_INSTALL_DATADIR
+include(GNUInstallDirs)
+
+if(HTTPLIB_COMPILE)
+ # Put the split script into the build dir
+ configure_file(split.py "${CMAKE_CURRENT_BINARY_DIR}/split.py"
+ COPYONLY
+ )
+ # Needs to be in the same dir as the python script
+ configure_file(httplib.h "${CMAKE_CURRENT_BINARY_DIR}/httplib.h"
+ COPYONLY
+ )
+
+ # Used outside of this if-else
+ set(_INTERFACE_OR_PUBLIC PUBLIC)
+ # Brings in the Python3_EXECUTABLE path we can use.
+ find_package(Python3 REQUIRED)
+ # Actually split the file
+ # Keeps the output in the build dir to not pollute the main dir
+ execute_process(COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/split.py"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ ERROR_VARIABLE _httplib_split_error
+ )
+ if(_httplib_split_error)
+ message(FATAL_ERROR "Failed when trying to split Cpp-httplib with the Python script.\n${_httplib_split_error}")
+ endif()
+
+ # split.py puts output in "out"
+ set(_httplib_build_includedir "${CMAKE_CURRENT_BINARY_DIR}/out")
+ # This will automatically be either static or shared based on the value of BUILD_SHARED_LIBS
+ add_library(${PROJECT_NAME} "${_httplib_build_includedir}/httplib.cc")
+ target_sources(${PROJECT_NAME}
+ PUBLIC
+ $<BUILD_INTERFACE:${_httplib_build_includedir}/httplib.h>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/httplib.h>
+ )
+else()
+ # This is for header-only.
+ set(_INTERFACE_OR_PUBLIC INTERFACE)
+ add_library(${PROJECT_NAME} INTERFACE)
+ set(_httplib_build_includedir "${CMAKE_CURRENT_SOURCE_DIR}")
+endif()
+# Lets you address the target with httplib::httplib
+# Only useful if building in-tree, versus using it from an installation.
+add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
+
+# Might be missing some, but this list is somewhat comprehensive
+target_compile_features(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
+ cxx_std_11
+ cxx_nullptr
+ cxx_lambdas
+ cxx_override
+ cxx_defaulted_functions
+ cxx_attribute_deprecated
+ cxx_auto_type
+ cxx_decltype
+ cxx_deleted_functions
+ cxx_range_for
+ cxx_sizeof_member
+)
+
+target_include_directories(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
+ $<BUILD_INTERFACE:${_httplib_build_includedir}>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
+
+# Always require threads
+target_link_libraries(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
+ Threads::Threads
+ # Needed for Windows libs on Mingw, as the pragma comment(lib, "xyz") aren't triggered.
+ $<$<PLATFORM_ID:Windows>:ws2_32>
+ $<$<PLATFORM_ID:Windows>:crypt32>
+ $<$<PLATFORM_ID:Windows>:cryptui>
+ # Can't put multiple targets in a single generator expression or it bugs out.
+ $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:Brotli::common>
+ $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:Brotli::encoder>
+ $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:Brotli::decoder>
+ $<$<BOOL:${HTTPLIB_IS_USING_ZLIB}>:ZLIB::ZLIB>
+ $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:OpenSSL::SSL>
+ $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:OpenSSL::Crypto>
+)
+
+# Set the definitions to enable optional features
+target_compile_definitions(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
+ $<$<BOOL:${HTTPLIB_IS_USING_BROTLI}>:CPPHTTPLIB_BROTLI_SUPPORT>
+ $<$<BOOL:${HTTPLIB_IS_USING_ZLIB}>:CPPHTTPLIB_ZLIB_SUPPORT>
+ $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:CPPHTTPLIB_OPENSSL_SUPPORT>
+)
+
+# Cmake's find_package search path is different based on the system
+# See https://cmake.org/cmake/help/latest/command/find_package.html for the list
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ set(_TARGET_INSTALL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/cmake/${PROJECT_NAME}")
+else()
+ # On Non-Windows, it should be /usr/lib/cmake/<name>/<name>Config.cmake
+ # NOTE: This may or may not work for macOS...
+ set(_TARGET_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
+endif()
+
+include(CMakePackageConfigHelpers)
+
+# Configures the meta-file httplibConfig.cmake.in to replace variables with paths/values/etc.
+configure_package_config_file("${PROJECT_NAME}Config.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
+ INSTALL_DESTINATION "${_TARGET_INSTALL_CMAKEDIR}"
+ # Passes the includedir install path
+ PATH_VARS CMAKE_INSTALL_FULL_INCLUDEDIR
+ # There aren't any components, so don't use the macro
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+)
+
+if(HTTPLIB_COMPILE)
+ write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
+ # Example: if you find_package(httplib 0.5.4)
+ # then anything >= 0.5 and <= 1.0 is accepted
+ COMPATIBILITY SameMajorVersion
+ )
+else()
+ write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
+ # Example: if you find_package(httplib 0.5.4)
+ # then anything >= 0.5 and <= 1.0 is accepted
+ COMPATIBILITY SameMajorVersion
+ # Tells Cmake that it's a header-only lib
+ # Mildly useful for end-users :)
+ ARCH_INDEPENDENT
+ )
+endif()
+
+# Creates the export httplibTargets.cmake
+# This is strictly what holds compilation requirements
+# and linkage information (doesn't find deps though).
+install(TARGETS ${PROJECT_NAME}
+ EXPORT httplibTargets
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+install(FILES "${_httplib_build_includedir}/httplib.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+ # Install it so it can be used later by the httplibConfig.cmake file.
+ # Put it in the same dir as our config file instead of a global path so we don't potentially stomp on other packages.
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindBrotli.cmake"
+ DESTINATION ${_TARGET_INSTALL_CMAKEDIR}
+)
+
+# NOTE: This path changes depending on if it's on Windows or Linux
+install(EXPORT httplibTargets
+ # Puts the targets into the httplib namespace
+ # So this makes httplib::httplib linkable after doing find_package(httplib)
+ NAMESPACE ${PROJECT_NAME}::
+ DESTINATION ${_TARGET_INSTALL_CMAKEDIR}
+)
diff --git a/LICENSE b/deps/cpp-httplib/LICENSE
index 3e5ed35..3e5ed35 100644
--- a/LICENSE
+++ b/deps/cpp-httplib/LICENSE
diff --git a/README.md b/deps/cpp-httplib/README.md
index 45a0e12..45a0e12 100644
--- a/README.md
+++ b/deps/cpp-httplib/README.md
diff --git a/cmake/FindBrotli.cmake b/deps/cpp-httplib/cmake/FindBrotli.cmake
index de1079c..de1079c 100644
--- a/cmake/FindBrotli.cmake
+++ b/deps/cpp-httplib/cmake/FindBrotli.cmake
diff --git a/example/Makefile b/deps/cpp-httplib/example/Makefile
index 931db09..931db09 100644
--- a/example/Makefile
+++ b/deps/cpp-httplib/example/Makefile
diff --git a/example/benchmark.cc b/deps/cpp-httplib/example/benchmark.cc
index 8e300b9..8e300b9 100644
--- a/example/benchmark.cc
+++ b/deps/cpp-httplib/example/benchmark.cc
diff --git a/example/ca-bundle.crt b/deps/cpp-httplib/example/ca-bundle.crt
index 7d61eb5..7d61eb5 100644
--- a/example/ca-bundle.crt
+++ b/deps/cpp-httplib/example/ca-bundle.crt
diff --git a/example/client.cc b/deps/cpp-httplib/example/client.cc
index a9b0fc0..a9b0fc0 100644
--- a/example/client.cc
+++ b/deps/cpp-httplib/example/client.cc
diff --git a/example/client.vcxproj b/deps/cpp-httplib/example/client.vcxproj
index 1abb773..1abb773 100644
--- a/example/client.vcxproj
+++ b/deps/cpp-httplib/example/client.vcxproj
diff --git a/example/example.sln b/deps/cpp-httplib/example/example.sln
index 81a3e78..81a3e78 100644
--- a/example/example.sln
+++ b/deps/cpp-httplib/example/example.sln
diff --git a/example/hello.cc b/deps/cpp-httplib/example/hello.cc
index 1590302..1590302 100644
--- a/example/hello.cc
+++ b/deps/cpp-httplib/example/hello.cc
diff --git a/example/redirect.cc b/deps/cpp-httplib/example/redirect.cc
index b1f3939..b1f3939 100644
--- a/example/redirect.cc
+++ b/deps/cpp-httplib/example/redirect.cc
diff --git a/example/server.cc b/deps/cpp-httplib/example/server.cc
index 1c347f5..1c347f5 100644
--- a/example/server.cc
+++ b/deps/cpp-httplib/example/server.cc
diff --git a/example/server.vcxproj b/deps/cpp-httplib/example/server.vcxproj
index 31ff203..31ff203 100644
--- a/example/server.vcxproj
+++ b/deps/cpp-httplib/example/server.vcxproj
diff --git a/example/simplecli.cc b/deps/cpp-httplib/example/simplecli.cc
index b005e40..b005e40 100644
--- a/example/simplecli.cc
+++ b/deps/cpp-httplib/example/simplecli.cc
diff --git a/example/simplesvr.cc b/deps/cpp-httplib/example/simplesvr.cc
index 17a9e98..17a9e98 100644
--- a/example/simplesvr.cc
+++ b/deps/cpp-httplib/example/simplesvr.cc
diff --git a/example/ssecli.cc b/deps/cpp-httplib/example/ssecli.cc
index 2c93822..2c93822 100644
--- a/example/ssecli.cc
+++ b/deps/cpp-httplib/example/ssecli.cc
diff --git a/example/ssesvr.cc b/deps/cpp-httplib/example/ssesvr.cc
index 4a58c66..4a58c66 100644
--- a/example/ssesvr.cc
+++ b/deps/cpp-httplib/example/ssesvr.cc
diff --git a/example/upload.cc b/deps/cpp-httplib/example/upload.cc
index 1e4f242..1e4f242 100644
--- a/example/upload.cc
+++ b/deps/cpp-httplib/example/upload.cc
diff --git a/httplib.h b/deps/cpp-httplib/httplib.h
index fff0bc4..fff0bc4 100644
--- a/httplib.h
+++ b/deps/cpp-httplib/httplib.h
diff --git a/httplibConfig.cmake.in b/deps/cpp-httplib/httplibConfig.cmake.in
index 4cd5ebf..4cd5ebf 100644
--- a/httplibConfig.cmake.in
+++ b/deps/cpp-httplib/httplibConfig.cmake.in
diff --git a/split.py b/deps/cpp-httplib/split.py
index 3bd0121..3bd0121 100644
--- a/split.py
+++ b/deps/cpp-httplib/split.py
diff --git a/test/Makefile b/deps/cpp-httplib/test/Makefile
index 832f8cc..832f8cc 100644
--- a/test/Makefile
+++ b/deps/cpp-httplib/test/Makefile
diff --git a/test/Makefile.fuzz_test b/deps/cpp-httplib/test/Makefile.fuzz_test
index bc582ed..bc582ed 100644
--- a/test/Makefile.fuzz_test
+++ b/deps/cpp-httplib/test/Makefile.fuzz_test
diff --git a/test/ca-bundle.crt b/deps/cpp-httplib/test/ca-bundle.crt
index 7d61eb5..7d61eb5 100644
--- a/test/ca-bundle.crt
+++ b/deps/cpp-httplib/test/ca-bundle.crt
diff --git a/test/fuzzing/Makefile b/deps/cpp-httplib/test/fuzzing/Makefile
index d6a3e21..d6a3e21 100644
--- a/test/fuzzing/Makefile
+++ b/deps/cpp-httplib/test/fuzzing/Makefile
diff --git a/test/fuzzing/corpus/1 b/deps/cpp-httplib/test/fuzzing/corpus/1
index 2b9fcc4..2b9fcc4 100644
--- a/test/fuzzing/corpus/1
+++ b/deps/cpp-httplib/test/fuzzing/corpus/1
diff --git a/test/fuzzing/corpus/2 b/deps/cpp-httplib/test/fuzzing/corpus/2
index bdb9bcc..bdb9bcc 100644
--- a/test/fuzzing/corpus/2
+++ b/deps/cpp-httplib/test/fuzzing/corpus/2
diff --git a/test/fuzzing/server_fuzzer.cc b/deps/cpp-httplib/test/fuzzing/server_fuzzer.cc
index 9fb4d4b..9fb4d4b 100644
--- a/test/fuzzing/server_fuzzer.cc
+++ b/deps/cpp-httplib/test/fuzzing/server_fuzzer.cc
diff --git a/test/fuzzing/server_fuzzer.dict b/deps/cpp-httplib/test/fuzzing/server_fuzzer.dict
index 47283dc..47283dc 100644
--- a/test/fuzzing/server_fuzzer.dict
+++ b/deps/cpp-httplib/test/fuzzing/server_fuzzer.dict
diff --git a/test/fuzzing/standalone_fuzz_target_runner.cpp b/deps/cpp-httplib/test/fuzzing/standalone_fuzz_target_runner.cpp
index 8e34792..8e34792 100644
--- a/test/fuzzing/standalone_fuzz_target_runner.cpp
+++ b/deps/cpp-httplib/test/fuzzing/standalone_fuzz_target_runner.cpp
diff --git a/test/gtest/gtest-all.cc b/deps/cpp-httplib/test/gtest/gtest-all.cc
index f2b0b6a..f2b0b6a 100644
--- a/test/gtest/gtest-all.cc
+++ b/deps/cpp-httplib/test/gtest/gtest-all.cc
diff --git a/test/gtest/gtest.h b/deps/cpp-httplib/test/gtest/gtest.h
index 1600e45..1600e45 100644
--- a/test/gtest/gtest.h
+++ b/deps/cpp-httplib/test/gtest/gtest.h
diff --git a/test/gtest/gtest_main.cc b/deps/cpp-httplib/test/gtest/gtest_main.cc
index a09bbe0..a09bbe0 100644
--- a/test/gtest/gtest_main.cc
+++ b/deps/cpp-httplib/test/gtest/gtest_main.cc
diff --git a/test/image.jpg b/deps/cpp-httplib/test/image.jpg
index f74b495..f74b495 100644
--- a/test/image.jpg
+++ b/deps/cpp-httplib/test/image.jpg
Binary files differ
diff --git a/test/proxy/Dockerfile b/deps/cpp-httplib/test/proxy/Dockerfile
index cd20938..cd20938 100644
--- a/test/proxy/Dockerfile
+++ b/deps/cpp-httplib/test/proxy/Dockerfile
diff --git a/test/proxy/basic_passwd b/deps/cpp-httplib/test/proxy/basic_passwd
index bb1b709..bb1b709 100644
--- a/test/proxy/basic_passwd
+++ b/deps/cpp-httplib/test/proxy/basic_passwd
diff --git a/test/proxy/basic_squid.conf b/deps/cpp-httplib/test/proxy/basic_squid.conf
index f97f09a..f97f09a 100644
--- a/test/proxy/basic_squid.conf
+++ b/deps/cpp-httplib/test/proxy/basic_squid.conf
diff --git a/test/proxy/digest_passwd b/deps/cpp-httplib/test/proxy/digest_passwd
index d45615f..d45615f 100644
--- a/test/proxy/digest_passwd
+++ b/deps/cpp-httplib/test/proxy/digest_passwd
diff --git a/test/proxy/digest_squid.conf b/deps/cpp-httplib/test/proxy/digest_squid.conf
index 050c5da..050c5da 100644
--- a/test/proxy/digest_squid.conf
+++ b/deps/cpp-httplib/test/proxy/digest_squid.conf
diff --git a/test/proxy/docker-compose.yml b/deps/cpp-httplib/test/proxy/docker-compose.yml
index 67a9e9b..67a9e9b 100644
--- a/test/proxy/docker-compose.yml
+++ b/deps/cpp-httplib/test/proxy/docker-compose.yml
diff --git a/test/proxy/down.sh b/deps/cpp-httplib/test/proxy/down.sh
index 6e0b3ee..6e0b3ee 100755
--- a/test/proxy/down.sh
+++ b/deps/cpp-httplib/test/proxy/down.sh
diff --git a/test/proxy/up.sh b/deps/cpp-httplib/test/proxy/up.sh
index a8341a6..a8341a6 100755
--- a/test/proxy/up.sh
+++ b/deps/cpp-httplib/test/proxy/up.sh
diff --git a/test/test.cc b/deps/cpp-httplib/test/test.cc
index df06444..df06444 100644
--- a/test/test.cc
+++ b/deps/cpp-httplib/test/test.cc
diff --git a/test/test.conf b/deps/cpp-httplib/test/test.conf
index 1cf7d63..1cf7d63 100644
--- a/test/test.conf
+++ b/deps/cpp-httplib/test/test.conf
diff --git a/test/test.rootCA.conf b/deps/cpp-httplib/test/test.rootCA.conf
index 9d7037d..9d7037d 100644
--- a/test/test.rootCA.conf
+++ b/deps/cpp-httplib/test/test.rootCA.conf
diff --git a/test/test.sln b/deps/cpp-httplib/test/test.sln
index 8377dd7..8377dd7 100644
--- a/test/test.sln
+++ b/deps/cpp-httplib/test/test.sln
diff --git a/test/test.vcxproj b/deps/cpp-httplib/test/test.vcxproj
index 22739d6..22739d6 100644
--- a/test/test.vcxproj
+++ b/deps/cpp-httplib/test/test.vcxproj
diff --git a/test/test_proxy.cc b/deps/cpp-httplib/test/test_proxy.cc
index 941b747..941b747 100644
--- a/test/test_proxy.cc
+++ b/deps/cpp-httplib/test/test_proxy.cc
diff --git a/test/www/dir/index.html b/deps/cpp-httplib/test/www/dir/index.html
index be3c05f..be3c05f 100644
--- a/test/www/dir/index.html
+++ b/deps/cpp-httplib/test/www/dir/index.html
diff --git a/test/www/dir/test.abcde b/deps/cpp-httplib/test/www/dir/test.abcde
index 6a81654..6a81654 100644
--- a/test/www/dir/test.abcde
+++ b/deps/cpp-httplib/test/www/dir/test.abcde
diff --git a/test/www/dir/test.html b/deps/cpp-httplib/test/www/dir/test.html
index 6d70cd0..6d70cd0 100644
--- a/test/www/dir/test.html
+++ b/deps/cpp-httplib/test/www/dir/test.html
diff --git a/test/www2/dir/index.html b/deps/cpp-httplib/test/www2/dir/index.html
index be3c05f..be3c05f 100644
--- a/test/www2/dir/index.html
+++ b/deps/cpp-httplib/test/www2/dir/index.html
diff --git a/test/www2/dir/test.html b/deps/cpp-httplib/test/www2/dir/test.html
index 6d70cd0..6d70cd0 100644
--- a/test/www2/dir/test.html
+++ b/deps/cpp-httplib/test/www2/dir/test.html
diff --git a/test/www3/dir/index.html b/deps/cpp-httplib/test/www3/dir/index.html
index be3c05f..be3c05f 100644
--- a/test/www3/dir/index.html
+++ b/deps/cpp-httplib/test/www3/dir/index.html
diff --git a/test/www3/dir/test.html b/deps/cpp-httplib/test/www3/dir/test.html
index 6d70cd0..6d70cd0 100644
--- a/test/www3/dir/test.html
+++ b/deps/cpp-httplib/test/www3/dir/test.html
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..3bcd0dd
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,71 @@
+#include <iostream>
+
+#include <httplib.h>
+#include <inja/inja.hpp>
+
+
+void example_inja_render(const httplib::Request& req, httplib::Response& res)
+{
+ inja::Environment env;
+ nlohmann::json data;
+ data["name"] = "Peter";
+ data["city"] = "Brunswick";
+ data["age"] = 29;
+ data["names"] = {"Jeff", "Seb"};
+ data["brother"]["name"] = "Chris";
+ data["brother"]["daughters"] = {"Maria", "Helen"};
+ data["brother"]["daughter0"] = { { "name", "Maria" } };
+ data["is_happy"] = true;
+ data["is_sad"] = false;
+ data["relatives"]["mother"] = "Maria";
+ data["relatives"]["brother"] = "Chris";
+ data["relatives"]["sister"] = "Jenny";
+ data["vars"] = {2, 3, 4, 0, -1, -2, -3};
+
+ res.set_content(
+ env.render("<html><body>\n"
+ "Hello {{ name }}! I come from {{ city }}.<br>\n"
+ "Hello {{ names.1 }}!<br>\n"
+ "Hello {{ brother.name }}!<br>\n"
+ "Hello {{ brother.daughter0.name }}!<br>\n"
+ "{{ \"{{ no_value }}\" }}<br>\n"
+ "Hello{# This is a comment #}!<br>\n"
+ "{# --- #Todo --- #}<br>\n"
+ "{% for name in names %}a{% endfor %}<br>\n"
+ "Hello {% for name in names %}{{ name }} {% endfor %}!<br>\n"
+ "Hello {% for name in names %}{{ loop.index }}: {{ name }}, {% endfor %}!<br>\n"
+ "{% for type, name in relatives %}{{ type }}: {{ name }}, {% endfor %}<br>\n"
+ "{% for v in vars %}{% if v > 0 %}+{% endif %}{% endfor %}<br>\n"
+ "{% for name in names %}{{ loop.index }}: {{ name }}{% if not loop.is_last %}, {% endif %}{% endfor %}!<br>\n"
+ "{% for name in names %}{{ loop.index }}: {{ name }}{% if loop.is_last == false %}, {% endif %}{% endfor %}!<br>\n"
+ "{% for name in {} %}a{% endfor %}<br>\n"
+ "</body></html>\n",
+ data), "text/html");
+}
+
+bool setup_httplib(const char * const addr, uint16_t port)
+{
+ using namespace httplib;
+
+ Server svr;
+
+ svr.Get("/", [](const Request& req, Response& res) {
+ example_inja_render(req, res);
+ });
+
+ svr.Get(R"(/numbers/(\d+))", [&](const Request& req, Response& res) {
+ auto numbers = req.matches[1];
+ res.set_content(numbers, "text/plain");
+ });
+
+ svr.Get("/stop", [&](const Request& req, Response& res) {
+ svr.stop();
+ });
+
+ return svr.listen(addr, port);
+}
+
+int main(int argc, char **argv)
+{
+ setup_httplib("127.0.0.1", 8080);
+}