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/httpasio.cpp | |
| parent | Merged main. (diff) | |
| download | zen-7232c5b126028ef859977d7a2a65fe9ca7b7300f.tar.xz zen-7232c5b126028ef859977d7a2a65fe9ca7b7300f.zip | |
Format fix.
Diffstat (limited to 'zenhttp/httpasio.cpp')
| -rw-r--r-- | zenhttp/httpasio.cpp | 34 |
1 files changed, 15 insertions, 19 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; } } |