Add Void::Net — HTTP client + URL parser + SOCKS5/CONNECT proxies
New SHARED module built on Boost.Beast/Asio + OpenSSL (all generic, no application coupling): - Void::Net::Url — RFC 3986 parse into scheme/host/port/path/query/target (Boost.URL), with scheme-default ports and TLS detection. - Void::Net::HttpClient — synchronous GET/POST/send with TLS (SNI), configurable User-Agent and TLS verification, request/response types. - Proxy support: HTTP CONNECT tunnelling for TLS targets, plain-HTTP forwarding, and a full SOCKS5 handshake (auth, IPv4/IPv6/domain). - Reuses Void::Encoding::Base64 for proxy auth. Build wiring: Dependencies.cmake resolves Boost (headers + url) and OpenSSL + Threads via find_package (system Boost/OpenSSL). Tests cover URL parsing and live localhost HTTP GET/POST round-trips (full suite 1136 pass). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
fb0506581f
commit
c92dff6ff7
8 files changed
+718
-5
No files matched your search
@@ -2,17 +2,21 @@ include(FetchContent)
|
||||
|
||||
function(void_fetch_dependency DEP_NAME)
|
||||
if(DEP_NAME STREQUAL "Boost")
|
||||
if(TARGET Boost::stacktrace_backtrace)
|
||||
# Components Void uses across modules: stacktrace_backtrace (Stacktrace),
|
||||
# url + system (Net; beast/asio are header-only and come via Boost::headers).
|
||||
if(TARGET Boost::stacktrace_backtrace AND TARGET Boost::url)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(Boost QUIET COMPONENTS stacktrace_backtrace)
|
||||
if(TARGET Boost::stacktrace_backtrace)
|
||||
# On modern Boost (1.85+) system/asio/beast are header-only and folded
|
||||
# into Boost::headers; only stacktrace_backtrace and url are components.
|
||||
find_package(Boost QUIET COMPONENTS stacktrace_backtrace url)
|
||||
if(TARGET Boost::stacktrace_backtrace AND TARGET Boost::url)
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "[Void] Boost::stacktrace_backtrace not found — falling back to FetchContent")
|
||||
set(BOOST_INCLUDE_LIBRARIES stacktrace CACHE STRING "" FORCE)
|
||||
message(STATUS "[Void] Boost (stacktrace/url) not found — falling back to FetchContent")
|
||||
set(BOOST_INCLUDE_LIBRARIES "stacktrace;url;system;beast;asio" CACHE STRING "" FORCE)
|
||||
set(BOOST_ENABLE_CMAKE ON CACHE BOOL "" FORCE)
|
||||
FetchContent_Declare(Boost
|
||||
URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
|
||||
@@ -26,6 +30,21 @@ function(void_fetch_dependency DEP_NAME)
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(DEP_NAME STREQUAL "OpenSSL")
|
||||
if(NOT TARGET OpenSSL::SSL)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(DEP_NAME STREQUAL "Threads")
|
||||
if(NOT TARGET Threads::Threads)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
# FIXME: Add if needed external
|
||||
# if(DEP_NAME STREQUAL "glaze")
|
||||
# if(NOT glaze_POPULATED)
|
||||
|
||||
Reference in new issue
Block a user