From ba785f3d91561deb624414b79db4306a795ded5d Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Sat, 10 Feb 2024 11:36:52 -0500 Subject: [PATCH] hide debug here (m_debug/m_verbose should be adhered to in classes as they *optionally* enable debug trace for modules, allowing the LogLevel to be set to 1 and not spam the log/console with unintended debug statements); alter bad handling of a compiler constant string for the Server/User-Agent strings; --- src/common/network/rest/http/HTTPPayload.cpp | 4 ++-- src/fne/network/RESTAPI.cpp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/common/network/rest/http/HTTPPayload.cpp b/src/common/network/rest/http/HTTPPayload.cpp index 08238489..1c6e369b 100644 --- a/src/common/network/rest/http/HTTPPayload.cpp +++ b/src/common/network/rest/http/HTTPPayload.cpp @@ -409,10 +409,10 @@ void HTTPPayload::ensureDefaultHeaders(const std::string& contentType) if (!isClientPayload) { headers.add("Content-Type", std::string(contentType)); headers.add("Content-Length", std::to_string(content.size())); - headers.add("Server", std::string((__EXE_NAME__ "/" __VER__))); + headers.add("Server", std::string(("DVM/" __VER__))); } else { - headers.add("User-Agent", std::string((__EXE_NAME__ "/" __VER__))); + headers.add("User-Agent", std::string(("DVM/" __VER__))); headers.add("Accept", "*/*"); if (::strtoupper(method) != HTTP_GET) { headers.add("Content-Type", std::string(contentType)); diff --git a/src/fne/network/RESTAPI.cpp b/src/fne/network/RESTAPI.cpp index 76d21e11..ea75fbd7 100644 --- a/src/fne/network/RESTAPI.cpp +++ b/src/fne/network/RESTAPI.cpp @@ -709,7 +709,10 @@ void RESTAPI::restAPI_GetPeerQuery(const HTTPPayload& request, HTTPPayload& repl uint32_t peerId = entry.first; network::FNEPeerConnection* peer = entry.second; if (peer != nullptr) { - LogDebug(LOG_REST, "Preparing Peer %u (%s) for REST API query", peerId, peer->address().c_str()); + if (m_debug) { + LogDebug(LOG_REST, "Preparing Peer %u (%s) for REST API query", peerId, peer->address().c_str()); + } + json::object peerObj = json::object(); peerObj["peerId"].set(peerId);