diff options
| author | Per Larsson <[email protected]> | 2021-12-09 17:02:21 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-12-09 17:02:21 +0100 |
| commit | 7232c5b126028ef859977d7a2a65fe9ca7b7300f (patch) | |
| tree | bfaa76f874ae65279b76f82a9eeb39075321b672 /zenhttp | |
| parent | Merged main. (diff) | |
| download | zen-7232c5b126028ef859977d7a2a65fe9ca7b7300f.tar.xz zen-7232c5b126028ef859977d7a2a65fe9ca7b7300f.zip | |
Format fix.
Diffstat (limited to 'zenhttp')
| -rw-r--r-- | zenhttp/httpasio.cpp | 34 | ||||
| -rw-r--r-- | zenhttp/httpserver.cpp | 6 | ||||
| -rw-r--r-- | zenhttp/httpsys.cpp | 2 | ||||
| -rw-r--r-- | zenhttp/httpsys.h | 4 |
4 files changed, 21 insertions, 25 deletions
diff --git a/zenhttp/httpasio.cpp b/zenhttp/httpasio.cpp index 7ee7193d1..08cefc3bc 100644 --- a/zenhttp/httpasio.cpp +++ b/zenhttp/httpasio.cpp @@ -18,9 +18,9 @@ ZEN_THIRD_PARTY_INCLUDES_END #define ASIO_VERBOSE_TRACE 0 #if ASIO_VERBOSE_TRACE -#define ZEN_TRACE_VERBOSE ZEN_TRACE +# define ZEN_TRACE_VERBOSE ZEN_TRACE #else -#define ZEN_TRACE_VERBOSE(fmtstr, ...) +# define ZEN_TRACE_VERBOSE(fmtstr, ...) #endif namespace zen::asio_http { @@ -403,10 +403,10 @@ HttpServerConnection::OnDataReceived(const asio::error_code& Ec, [[maybe_unused] } ZEN_TRACE_VERBOSE("on data received, connection '{}', request '{}', thread '{}', bytes '{}'", - m_ConnectionId, - m_RequestCounter.load(std::memory_order_relaxed), - GetCurrentThreadId(), - NiceBytes(ByteCount)); + m_ConnectionId, + m_RequestCounter.load(std::memory_order_relaxed), + GetCurrentThreadId(), + NiceBytes(ByteCount)); while (m_RequestBuffer.size()) { @@ -441,10 +441,10 @@ HttpServerConnection::OnResponseDataSent(const asio::error_code& Ec, [[maybe_unu else { ZEN_TRACE_VERBOSE("on data sent, connection '{}', request '{}', thread '{}', bytes '{}'", - m_ConnectionId, - m_RequestCounter.load(std::memory_order_relaxed), - GetCurrentThreadId(), - NiceBytes(ByteCount)); + m_ConnectionId, + m_RequestCounter.load(std::memory_order_relaxed), + GetCurrentThreadId(), + NiceBytes(ByteCount)); if (!m_RequestData.IsKeepAlive()) { @@ -495,7 +495,6 @@ HttpServerConnection::HandleRequest() { HttpAsioServerRequest Request(m_RequestData, *Service, m_RequestData.Body()); - ZEN_TRACE_VERBOSE("handle request, connection '{}' request '{}'", m_ConnectionId, m_RequestCounter.load(std::memory_order_relaxed)); if (!HandlePackageOffers(*Service, Request, m_PackageHandler)) @@ -510,7 +509,6 @@ HttpServerConnection::HandleRequest() Request.WriteResponse(HttpResponseCode::InternalServerError, HttpContentType::kText, ex.what()); } - } if (std::unique_ptr<HttpResponse> Response = std::move(Request.m_Response)) @@ -767,7 +765,7 @@ NormalizeUrlPath(const char* Url, size_t UrlLength, std::string& NormalizedUrl) bool LastCharWasSeparator = false; for (std::string_view::size_type UrlIndex = 0; UrlIndex < UrlLength; ++UrlIndex) { - const char UrlChar = Url[UrlIndex]; + const char UrlChar = Url[UrlIndex]; const bool IsSeparator = (UrlChar == '/'); if (IsSeparator && LastCharWasSeparator) @@ -860,7 +858,6 @@ HttpRequest::OnHeadersComplete() NormalizeUrlPath(m_Url, m_UrlLength, m_NormalizedUrl); - return 0; } @@ -1172,18 +1169,17 @@ HttpAsioServerImpl::RouteRequest(std::string_view Url) { RwLock::SharedLockScope _(m_Lock); - HttpService* CandidateService = nullptr; + HttpService* CandidateService = nullptr; std::string::size_type CandidateMatchSize = 0; for (const ServiceEntry& SvcEntry : m_UriHandlers) { - const std::string& SvcUrl = SvcEntry.ServiceUrlPath; + const std::string& SvcUrl = SvcEntry.ServiceUrlPath; const std::string::size_type SvcUrlSize = SvcUrl.size(); - if ((SvcUrlSize >= CandidateMatchSize) && - Url.compare(0, SvcUrlSize, SvcUrl) == 0 && + if ((SvcUrlSize >= CandidateMatchSize) && Url.compare(0, SvcUrlSize, SvcUrl) == 0 && ((SvcUrlSize == Url.size()) || (Url[SvcUrlSize] == '/'))) { CandidateMatchSize = SvcUrl.size(); - CandidateService = SvcEntry.Service; + CandidateService = SvcEntry.Service; } } diff --git a/zenhttp/httpserver.cpp b/zenhttp/httpserver.cpp index 3326f3d4a..b1bf99bce 100644 --- a/zenhttp/httpserver.cpp +++ b/zenhttp/httpserver.cpp @@ -578,8 +578,6 @@ void HttpRpcHandler::AddRpc(std::string_view RpcId, std::function<void(CbObject& RpcArgs)> HandlerFunction) { ZEN_UNUSED(RpcId, HandlerFunction); - - } ////////////////////////////////////////////////////////////////////////// @@ -705,7 +703,9 @@ HandlePackageOffers(HttpService& Service, HttpServerRequest& Request, Ref<IHttpP { PackageHandlerRef->OnRequestBegin(); - auto CreateBuffer = [&](const IoHash& Cid, uint64_t Size) -> IoBuffer { return PackageHandlerRef->CreateTarget(Cid, Size); }; + auto CreateBuffer = [&](const IoHash& Cid, uint64_t Size) -> IoBuffer { + return PackageHandlerRef->CreateTarget(Cid, Size); + }; CbPackage Package = ParsePackageMessage(Request.ReadPayload(), CreateBuffer); diff --git a/zenhttp/httpsys.cpp b/zenhttp/httpsys.cpp index e9472e3b8..78cf253cc 100644 --- a/zenhttp/httpsys.cpp +++ b/zenhttp/httpsys.cpp @@ -791,7 +791,7 @@ HttpSysServer::InitializeServer(int BasePort) // port for the current user. eg: // netsh http add urlacl url=http://*:1337/ user=<some_user> - const std::u8string_view Hosts[] = { u8"[::1]"sv, u8"localhost"sv, u8"127.0.0.1"sv }; + const std::u8string_view Hosts[] = {u8"[::1]"sv, u8"localhost"sv, u8"127.0.0.1"sv}; for (const std::u8string_view Host : Hosts) { diff --git a/zenhttp/httpsys.h b/zenhttp/httpsys.h index 7df8fba8f..06bad99c3 100644 --- a/zenhttp/httpsys.h +++ b/zenhttp/httpsys.h @@ -76,8 +76,8 @@ private: WorkerThreadPool m_AsyncWorkPool; std::vector<std::wstring> m_BaseUris; // eg: http://*:nnnn/ - HTTP_SERVER_SESSION_ID m_HttpSessionId = 0; - HTTP_URL_GROUP_ID m_HttpUrlGroupId = 0; + HTTP_SERVER_SESSION_ID m_HttpSessionId = 0; + HTTP_URL_GROUP_ID m_HttpUrlGroupId = 0; HANDLE m_RequestQueueHandle = 0; std::atomic_int32_t m_PendingRequests{0}; std::atomic_int32_t m_IsShuttingDown{0}; |