aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-04-13 12:42:58 +0200
committerGitHub Enterprise <[email protected]>2026-04-13 12:42:58 +0200
commit2d902f99fbfc11b874f4c50fa648f10340e4f0cc (patch)
tree8767ab7079bdc4a2f07c3ddee2a8051b0b5e218e /src/zenhttp
parentLogging and diagnostics improvements (#941) (diff)
downloadzen-2d902f99fbfc11b874f4c50fa648f10340e4f0cc.tar.xz
zen-2d902f99fbfc11b874f4c50fa648f10340e4f0cc.zip
minor fixups (#948)
* objectstore.cpp - m_TotalBytesServed now tracks all range cases (single, multi, 416) * async http: docstring corrected: curl_multi_socket_action() / ASIO socket async_wait remove non-ascii characters * fix singlethreaded gc option in lua to not use dash * fix changelog order
Diffstat (limited to 'src/zenhttp')
-rw-r--r--src/zenhttp/clients/asynchttpclient.cpp36
-rw-r--r--src/zenhttp/include/zenhttp/asynchttpclient.h6
2 files changed, 21 insertions, 21 deletions
diff --git a/src/zenhttp/clients/asynchttpclient.cpp b/src/zenhttp/clients/asynchttpclient.cpp
index bdf7f160c..4b189af36 100644
--- a/src/zenhttp/clients/asynchttpclient.cpp
+++ b/src/zenhttp/clients/asynchttpclient.cpp
@@ -100,7 +100,7 @@ struct AsyncHttpClient::Impl
{
// Clean up curl state on the strand where all curl_multi operations
// are serialized. Use a promise to block until the cleanup handler
- // has actually executed — essential for the external io_context case
+ // has actually executed - essential for the external io_context case
// where we don't own the run loop.
std::promise<void> Done;
std::future<void> DoneFuture = Done.get_future();
@@ -109,7 +109,7 @@ struct AsyncHttpClient::Impl
m_ShuttingDown = true;
m_Timer.cancel();
- // Release all tracked sockets (don't close — curl owns the fds).
+ // Release all tracked sockets (don't close - curl owns the fds).
for (auto& [Fd, Info] : m_Sockets)
{
if (Info->Socket.is_open())
@@ -178,7 +178,7 @@ struct AsyncHttpClient::Impl
}
}
- // ── Handle pool ─────────────────────────────────────────────────────
+ // -- Handle pool -----------------------------------------------------
CURL* AllocHandle()
{
@@ -199,7 +199,7 @@ struct AsyncHttpClient::Impl
void ReleaseHandle(CURL* Handle) { m_HandlePool.push_back(Handle); }
- // ── Configure a handle with common settings ─────────────────────────
+ // -- Configure a handle with common settings -------------------------
// Called only from DoAsync* lambdas running on the strand.
void ConfigureHandle(CURL* Handle, std::string_view ResourcePath, const HttpClient::KeyValueMap& Parameters)
@@ -258,7 +258,7 @@ struct AsyncHttpClient::Impl
}
}
- // ── Access token ────────────────────────────────────────────────────
+ // -- Access token ----------------------------------------------------
std::optional<std::string> GetAccessToken()
{
@@ -293,7 +293,7 @@ struct AsyncHttpClient::Impl
return {};
}
- // ── Submit a transfer ───────────────────────────────────────────────
+ // -- Submit a transfer -----------------------------------------------
void SubmitTransfer(CURL* Handle, std::unique_ptr<TransferContext> Ctx)
{
@@ -323,7 +323,7 @@ struct AsyncHttpClient::Impl
}
}
- // ── Socket-action integration ───────────────────────────────────────
+ // -- Socket-action integration ---------------------------------------
//
// curl_multi drives I/O via two callbacks:
// - SocketCallback: curl tells us which sockets to watch for read/write
@@ -341,7 +341,7 @@ struct AsyncHttpClient::Impl
explicit SocketInfo(asio::io_context& IoContext) : Socket(IoContext) {}
};
- // Static thunks registered with curl_multi ────────────────────────────
+ // Static thunks registered with curl_multi ----------------------------
static int CurlSocketCallback(CURL* Easy, curl_socket_t Fd, int Action, void* UserPtr, void* SocketPtr)
{
@@ -367,7 +367,7 @@ struct AsyncHttpClient::Impl
curl_multi_setopt(m_Multi, CURLMOPT_TIMERDATA, this);
}
- // Called by curl when socket watch state changes ──────────────────────
+ // Called by curl when socket watch state changes ---------------------
void OnCurlSocket(curl_socket_t Fd, int Action, SocketInfo* Info)
{
@@ -389,7 +389,7 @@ struct AsyncHttpClient::Impl
if (!Info)
{
- // New socket — wrap the native fd in an ASIO socket.
+ // New socket - wrap the native fd in an ASIO socket.
auto [It, Inserted] = m_Sockets.emplace(Fd, std::make_unique<SocketInfo>(m_IoContext));
Info = It->second.get();
@@ -458,7 +458,7 @@ struct AsyncHttpClient::Impl
}
}
- // Called by curl when it wants a timeout ──────────────────────────────
+ // Called by curl when it wants a timeout ------------------------------
void OnCurlTimer(long TimeoutMs)
{
@@ -472,7 +472,7 @@ struct AsyncHttpClient::Impl
if (TimeoutMs == 0)
{
- // curl wants immediate action — run it directly on the strand.
+ // curl wants immediate action - run it directly on the strand.
asio::post(m_Strand, [this]() {
if (m_ShuttingDown)
{
@@ -498,7 +498,7 @@ struct AsyncHttpClient::Impl
}));
}
- // Drain completed transfers from curl_multi ──────────────────────────
+ // Drain completed transfers from curl_multi --------------------------
void CheckCompleted()
{
@@ -605,7 +605,7 @@ struct AsyncHttpClient::Impl
});
}
- // ── Async verb implementations ──────────────────────────────────────
+ // -- Async verb implementations --------------------------------------
void DoAsyncGet(std::string Url,
AsyncHttpCallback Callback,
@@ -816,7 +816,7 @@ struct AsyncHttpClient::Impl
});
}
- // ── Members ─────────────────────────────────────────────────────────
+ // -- Members ---------------------------------------------------------
std::string m_BaseUri;
HttpClientSettings m_Settings;
@@ -824,7 +824,7 @@ struct AsyncHttpClient::Impl
std::string m_SessionId;
std::string m_UnixSocketPathUtf8;
- // io_context and strand — all curl_multi operations are serialized on the
+ // io_context and strand - all curl_multi operations are serialized on the
// strand, making this safe even when the io_context has multiple threads.
std::unique_ptr<asio::io_context> m_OwnedIoContext;
asio::io_context& m_IoContext;
@@ -861,7 +861,7 @@ AsyncHttpClient::AsyncHttpClient(std::string_view BaseUri, asio::io_context& IoC
AsyncHttpClient::~AsyncHttpClient() = default;
-// ── Callback-based API ──────────────────────────────────────────────────
+// -- Callback-based API --------------------------------------------------
void
AsyncHttpClient::AsyncGet(std::string_view Url,
@@ -925,7 +925,7 @@ AsyncHttpClient::AsyncPut(std::string_view Url, AsyncHttpCallback Callback, cons
m_Impl->DoAsyncPutNoPayload(std::string(Url), std::move(Callback), Parameters);
}
-// ── Future-based API ────────────────────────────────────────────────────
+// -- Future-based API ----------------------------------------------------
std::future<HttpClient::Response>
AsyncHttpClient::Get(std::string_view Url, const KeyValueMap& AdditionalHeader, const KeyValueMap& Parameters)
diff --git a/src/zenhttp/include/zenhttp/asynchttpclient.h b/src/zenhttp/include/zenhttp/asynchttpclient.h
index 58429349d..cb41626b9 100644
--- a/src/zenhttp/include/zenhttp/asynchttpclient.h
+++ b/src/zenhttp/include/zenhttp/asynchttpclient.h
@@ -21,7 +21,7 @@ using AsyncHttpCallback = std::function<void(HttpClient::Response)>;
/** Asynchronous HTTP client backed by curl_multi and ASIO.
*
- * Uses curl_multi_perform() driven by an ASIO steady_timer to process
+ * Uses curl_multi_socket_action() driven by ASIO socket async_wait to process
* transfers without blocking the caller. All curl_multi operations are
* serialized on an internal strand; callers may issue requests from any
* thread, and the io_context may have multiple threads.
@@ -53,7 +53,7 @@ public:
AsyncHttpClient(const AsyncHttpClient&) = delete;
AsyncHttpClient& operator=(const AsyncHttpClient&) = delete;
- // ── Callback-based API ──────────────────────────────────────────────
+ // -- Callback-based API ----------------------------------------------
void AsyncGet(std::string_view Url,
AsyncHttpCallback Callback,
@@ -85,7 +85,7 @@ public:
void AsyncPut(std::string_view Url, AsyncHttpCallback Callback, const KeyValueMap& Parameters = {});
- // ── Future-based API ────────────────────────────────────────────────
+ // -- Future-based API ------------------------------------------------
[[nodiscard]] std::future<Response> Get(std::string_view Url,
const KeyValueMap& AdditionalHeader = {},