diff options
| author | Stefan Boberg <[email protected]> | 2026-02-23 17:48:17 +0100 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2026-02-23 17:48:17 +0100 |
| commit | 8140219e3251551788f6de23e22a8a413d5106b1 (patch) | |
| tree | 72e98c5cf698a0d9dbeab81fc8c5ae1ab69c7ca5 /src/zenhttp/httpserver.cpp | |
| parent | removed spurious ryml file (diff) | |
| download | zen-8140219e3251551788f6de23e22a8a413d5106b1.tar.xz zen-8140219e3251551788f6de23e22a8a413d5106b1.zip | |
made it so HttpServer::GetServiceUri returns an IP instead of the machine name, for better resolution
Diffstat (limited to 'src/zenhttp/httpserver.cpp')
| -rw-r--r-- | src/zenhttp/httpserver.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/zenhttp/httpserver.cpp b/src/zenhttp/httpserver.cpp index d6dfb347f..3cefa0ad8 100644 --- a/src/zenhttp/httpserver.cpp +++ b/src/zenhttp/httpserver.cpp @@ -1016,19 +1016,26 @@ int HttpServer::Initialize(int BasePort, std::filesystem::path DataDir) { m_EffectivePort = OnInitialize(BasePort, std::move(DataDir)); + m_ExternalHost = OnGetExternalHost(); return m_EffectivePort; } std::string +HttpServer::OnGetExternalHost() const +{ + return GetMachineName(); +} + +std::string HttpServer::GetServiceUri(const HttpService* Service) const { if (Service) { - return fmt::format("http://{}:{}{}", GetMachineName(), m_EffectivePort, Service->BaseUri()); + return fmt::format("http://{}:{}{}", m_ExternalHost, m_EffectivePort, Service->BaseUri()); } else { - return fmt::format("http://{}:{}", GetMachineName(), m_EffectivePort); + return fmt::format("http://{}:{}", m_ExternalHost, m_EffectivePort); } } |