net: add blocking HTTP/HTTPS GET client

A small libssl-backed client (naut_http_get) that fetches a URL over
plain HTTP or TLS, follows 3xx redirects, and decodes Content-Length
and chunked bodies. Foundation for the RSS poller and Torznab search.
Built as a PIC static lib so it can link into the webui plugin module.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ookami125 2026-06-23 00:41:31 -04:00
parent dbd0d6f78e
commit 0393ed429b
3 changed files with 299 additions and 2 deletions

View file

@ -37,7 +37,7 @@ find_path(URING_INC liburing.h)
if(NOT URING_LIB OR NOT URING_INC)
message(FATAL_ERROR "liburing not found (install liburing-dev)")
endif()
find_package(OpenSSL REQUIRED COMPONENTS Crypto)
find_package(OpenSSL REQUIRED COMPONENTS Crypto SSL)
# --- external download engine + tracker/DHT protocol libraries --------------
# torrent-peer: multi-peer download engine (engine.h) — replaces Naut's own peer
@ -163,6 +163,13 @@ add_library(naut_discovery STATIC
src/discovery/tracker_client.c src/discovery/dht_client.c)
target_link_libraries(naut_discovery PUBLIC naut_core torrenttracker)
# --- net: blocking HTTP/HTTPS client (RSS feeds, Torznab search) -------------
# PIC so it can be linked into the webui plugin module; naut_log symbols resolve
# from the host executable at load time, like the rest of the plugin.
add_library(naut_net STATIC src/net/http_client.c)
set_target_properties(naut_net PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(naut_net PUBLIC OpenSSL::SSL OpenSSL::Crypto)
# --- peer: wire protocol codec (sans-IO), retained for magnet metadata -------
add_library(naut_peer STATIC
src/peer/wire.c src/peer/extension.c src/peer/metadata.c)
@ -215,7 +222,7 @@ set_target_properties(naut_example PROPERTIES PREFIX "")
add_library(naut_webui MODULE plugins/webui/webui.c)
target_include_directories(naut_webui PRIVATE ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(naut_webui PRIVATE ${NAUT_JANSSON_TARGET} pthread)
target_link_libraries(naut_webui PRIVATE ${NAUT_JANSSON_TARGET} naut_net pthread)
set_target_properties(naut_webui PROPERTIES PREFIX "")
# --- swarm: multi-peer download driver over the torrent-peer engine ---------