aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/clients
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-03-13 09:24:59 +0100
committerGitHub Enterprise <[email protected]>2026-03-13 09:24:59 +0100
commitef586f5930ac761f8e8e18cde2ebd5248efeaa4a (patch)
treebe6c7d3e11f9261c1d03d646bc579ac0d27452d7 /src/zenhttp/clients
parentSwitch httpclient default back-end over to libcurl (#832) (diff)
downloadzen-ef586f5930ac761f8e8e18cde2ebd5248efeaa4a.tar.xz
zen-ef586f5930ac761f8e8e18cde2ebd5248efeaa4a.zip
Unix Domain Socket auto discovery (#833)
This PR adds end-to-end Unix domain socket (UDS) support, allowing zen CLI to discover and connect to UDS-only servers automatically. - **`unix://` URI scheme in zen CLI**: The `-u` / `--hosturl` option now accepts `unix:///path/to/socket` to connect to a zenserver via a Unix domain socket instead of TCP. - **Per-instance shared memory for extended server info**: Each zenserver instance now publishes a small shared memory section (keyed by SessionId) containing per-instance data that doesn't fit in the fixed-size ZenServerEntry -- starting with the UDS socket path. This is a 4KB pagefile-backed section on Windows (`Global\ZenInstance_{sessionid}`) and a POSIX shared memory object on Linux/Mac (`/UnrealEngineZen_{sessionid}`). - **Client-side auto-discovery of UDS servers**: `zen info`, `zen status`, etc. now automatically discover and prefer UDS connections when a server publishes a socket path. Servers running with `--no-network` (UDS-only) are no longer invisible to the CLI. - **`kNoNetwork` flag in ZenServerEntry**: Servers started with `--no-network` advertise this in their shared state entry. Clients skip TCP fallback for these servers, and display commands (`ps`, `status`, `top`) show `-` instead of a port number to indicate TCP is not available.
Diffstat (limited to 'src/zenhttp/clients')
-rw-r--r--src/zenhttp/clients/httpclientcpr.cpp3
-rw-r--r--src/zenhttp/clients/httpclientcurl.cpp4
-rw-r--r--src/zenhttp/clients/httpwsclient.cpp4
3 files changed, 8 insertions, 3 deletions
diff --git a/src/zenhttp/clients/httpclientcpr.cpp b/src/zenhttp/clients/httpclientcpr.cpp
index a0f5cc38f..a52b8f74b 100644
--- a/src/zenhttp/clients/httpclientcpr.cpp
+++ b/src/zenhttp/clients/httpclientcpr.cpp
@@ -7,6 +7,7 @@
#include <zencore/compactbinarypackage.h>
#include <zencore/compactbinaryutil.h>
#include <zencore/compress.h>
+#include <zencore/filesystem.h>
#include <zencore/iobuffer.h>
#include <zencore/iohash.h>
#include <zencore/session.h>
@@ -513,7 +514,7 @@ CprHttpClient::AllocSession(const std::string_view BaseUrl,
if (!ConnectionSettings.UnixSocketPath.empty())
{
- CprSession->SetUnixSocket(cpr::UnixSocket(ConnectionSettings.UnixSocketPath));
+ CprSession->SetUnixSocket(cpr::UnixSocket(PathToUtf8(ConnectionSettings.UnixSocketPath)));
}
if (ConnectionSettings.InsecureSsl || !ConnectionSettings.CaBundlePath.empty())
diff --git a/src/zenhttp/clients/httpclientcurl.cpp b/src/zenhttp/clients/httpclientcurl.cpp
index 0dbd5b975..ec9b7bac6 100644
--- a/src/zenhttp/clients/httpclientcurl.cpp
+++ b/src/zenhttp/clients/httpclientcurl.cpp
@@ -8,6 +8,7 @@
#include <zencore/compactbinaryutil.h>
#include <zencore/compress.h>
#include <zencore/except.h>
+#include <zencore/filesystem.h>
#include <zencore/iobuffer.h>
#include <zencore/iohash.h>
#include <zencore/session.h>
@@ -808,7 +809,8 @@ CurlHttpClient::AllocSession(std::string_view ResourcePath, const KeyValueMap& P
// Unix domain socket
if (!m_ConnectionSettings.UnixSocketPath.empty())
{
- curl_easy_setopt(Handle, CURLOPT_UNIX_SOCKET_PATH, m_ConnectionSettings.UnixSocketPath.c_str());
+ std::string SocketPathUtf8 = PathToUtf8(m_ConnectionSettings.UnixSocketPath);
+ curl_easy_setopt(Handle, CURLOPT_UNIX_SOCKET_PATH, SocketPathUtf8.c_str());
}
// Build URL with parameters
diff --git a/src/zenhttp/clients/httpwsclient.cpp b/src/zenhttp/clients/httpwsclient.cpp
index 2d566ae86..fbae9f5fe 100644
--- a/src/zenhttp/clients/httpwsclient.cpp
+++ b/src/zenhttp/clients/httpwsclient.cpp
@@ -5,6 +5,8 @@
#include "../servers/wsframecodec.h"
#include <zencore/base64.h>
+#include <zencore/filesystem.h>
+#include <zencore/fmtutils.h>
#include <zencore/logging.h>
#include <zencore/string.h>
@@ -155,7 +157,7 @@ struct HttpWsClient::Impl
}
});
- asio::local::stream_protocol::endpoint Endpoint(m_Settings.UnixSocketPath);
+ asio::local::stream_protocol::endpoint Endpoint(PathToUtf8(m_Settings.UnixSocketPath));
m_UnixSocket->async_connect(Endpoint, [this](const asio::error_code& Ec) {
if (Ec)
{