aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/httpserver.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-03-09 20:37:47 +0100
committerStefan Boberg <[email protected]>2026-03-09 20:37:47 +0100
commitdd93a5714bf9c81d22c24c577e352686cbc8480e (patch)
treed92480383e5b1b2e97fe93b40425d69725a1e421 /src/zenhttp/httpserver.cpp
parentfixed up httpasio Windows/TransmitFile for domain sockets (diff)
downloadzen-dd93a5714bf9c81d22c24c577e352686cbc8480e.tar.xz
zen-dd93a5714bf9c81d22c24c577e352686cbc8480e.zip
add basic HTTPS support for http.sys
Diffstat (limited to 'src/zenhttp/httpserver.cpp')
-rw-r--r--src/zenhttp/httpserver.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/zenhttp/httpserver.cpp b/src/zenhttp/httpserver.cpp
index bbb7cd695..029f7be1b 100644
--- a/src/zenhttp/httpserver.cpp
+++ b/src/zenhttp/httpserver.cpp
@@ -1043,13 +1043,16 @@ HttpServer::OnGetExternalHost() const
std::string
HttpServer::GetServiceUri(const HttpService* Service) const
{
+ const char* Scheme = (m_EffectiveHttpsPort > 0) ? "https" : "http";
+ int Port = (m_EffectiveHttpsPort > 0) ? m_EffectiveHttpsPort : m_EffectivePort;
+
if (Service)
{
- return fmt::format("http://{}:{}{}", m_ExternalHost, m_EffectivePort, Service->BaseUri());
+ return fmt::format("{}://{}:{}{}", Scheme, m_ExternalHost, Port, Service->BaseUri());
}
else
{
- return fmt::format("http://{}:{}", m_ExternalHost, m_EffectivePort);
+ return fmt::format("{}://{}:{}", Scheme, m_ExternalHost, Port);
}
}
@@ -1132,7 +1135,11 @@ CreateHttpServerClass(const std::string_view ServerClass, const HttpServerConfig
.IsAsyncResponseEnabled = Config.HttpSys.IsAsyncResponseEnabled,
.IsRequestLoggingEnabled = Config.HttpSys.IsRequestLoggingEnabled,
.IsDedicatedServer = Config.IsDedicatedServer,
- .ForceLoopback = Config.ForceLoopback}));
+ .ForceLoopback = Config.ForceLoopback,
+ .HttpsPort = Config.HttpSys.HttpsPort,
+ .CertThumbprint = Config.HttpSys.CertThumbprint,
+ .CertStoreName = Config.HttpSys.CertStoreName,
+ .HttpsOnly = Config.HttpSys.HttpsOnly}));
}
#endif
else if (ServerClass == "null"sv)