diff options
| author | Stefan Boberg <[email protected]> | 2023-12-05 15:13:40 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-12-05 15:13:40 +0100 |
| commit | 311326f0eff2a77892ca533bd46a4bb53444699c (patch) | |
| tree | 036e560fe9fbb1800f21a035c7925f4c8a7e9f0e | |
| parent | HTTP plugin request debug logging (#587) (diff) | |
| download | zen-311326f0eff2a77892ca533bd46a4bb53444699c.tar.xz zen-311326f0eff2a77892ca533bd46a4bb53444699c.zip | |
http plugin dependency fixes (#590)
these changes clean up module dependencies and allow the transports subtree to be built standalone (in the UE tree for instance)
| -rw-r--r-- | src/transports/winsock/xmake.lua | 4 | ||||
| -rw-r--r-- | src/transports/xmake.lua | 4 | ||||
| -rw-r--r-- | src/zenhttp/servers/httpplugin.cpp | 14 |
3 files changed, 17 insertions, 5 deletions
diff --git a/src/transports/winsock/xmake.lua b/src/transports/winsock/xmake.lua index 552a62702..c14283546 100644 --- a/src/transports/winsock/xmake.lua +++ b/src/transports/winsock/xmake.lua @@ -6,9 +6,9 @@ target("winsock") add_headerfiles("**.h") add_files("**.cpp") add_links("Ws2_32") - add_includedirs(".", "../../zenbase/include") + add_includedirs(".") set_symbols("debug") - add_deps("transport-sdk") + add_deps("zenbase", "transport-sdk") if is_mode("release") then set_optimize("fastest") diff --git a/src/transports/xmake.lua b/src/transports/xmake.lua index 44800a8af..78d637d85 100644 --- a/src/transports/xmake.lua +++ b/src/transports/xmake.lua @@ -5,6 +5,10 @@ set_languages("cxx20") includes('transport-sdk') +if os.isdir('zenbase') then + includes('zenbase') +end + if is_plat("windows") then includes("winsock") end diff --git a/src/zenhttp/servers/httpplugin.cpp b/src/zenhttp/servers/httpplugin.cpp index 8795fbcaa..3eed9db8f 100644 --- a/src/zenhttp/servers/httpplugin.cpp +++ b/src/zenhttp/servers/httpplugin.cpp @@ -365,6 +365,7 @@ HttpPluginConnectionHandler::HandleRequest() const HttpVerb RequestVerb = Request.RequestVerb(); const std::string_view Uri = Request.RelativeUri(); + if (m_Server->m_RequestLog.ShouldLog(logging::level::Trace)) { ZEN_LOG_TRACE(m_Server->m_RequestLog, "connection #{} Handling Request: {} {} ({} bytes ({}), accept: {})", @@ -439,7 +440,10 @@ HttpPluginConnectionHandler::HandleRequest() const std::vector<IoBuffer>& ResponseBuffers = Response->ResponseBuffers(); - m_Server->WriteDebugPayload(fmt::format("response_{}_{}.bin", m_ConnectionId, RequestNumber), ResponseBuffers); + if (m_Server->m_RequestLog.ShouldLog(logging::level::Trace)) + { + m_Server->WriteDebugPayload(fmt::format("response_{}_{}.bin", m_ConnectionId, RequestNumber), ResponseBuffers); + } for (const IoBuffer& Buffer : ResponseBuffers) { @@ -656,7 +660,6 @@ HttpPluginServerRequest::TryGetRanges(HttpRanges& Ranges) HttpPluginServerImpl::HttpPluginServerImpl() : m_RequestLog(logging::Get("http_requests")) { - m_RequestLog.SetLogLevel(logging::level::Trace); } HttpPluginServerImpl::~HttpPluginServerImpl() @@ -848,13 +851,18 @@ HttpPluginServerImpl::RouteRequest(std::string_view Url) void HttpPluginServerImpl::WriteDebugPayload(std::string_view Filename, const std::span<const IoBuffer> Payload) { + uint64_t PayloadSize = 0; std::vector<const IoBuffer*> Buffers; for (auto& Io : Payload) { Buffers.push_back(&Io); + PayloadSize += Io.GetSize(); } - WriteFile(m_PayloadDir / Filename, Buffers.data(), Buffers.size()); + if (PayloadSize) + { + WriteFile(m_PayloadDir / Filename, Buffers.data(), Buffers.size()); + } } ////////////////////////////////////////////////////////////////////////// |