diff options
| author | Per Larsson <[email protected]> | 2022-01-11 10:31:34 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2022-01-11 10:31:34 +0100 |
| commit | fa40b11e35f9791bd6ca472ef7bfc246eecbd696 (patch) | |
| tree | 058c1dcef54eb3c15eedc12b29f24d72db239d52 /zenhttp | |
| parent | Added option to disable Sentry crash handler. (diff) | |
| parent | Not all toolchains support C++20's atomic<double>::fetch_add() (diff) | |
| download | zen-fa40b11e35f9791bd6ca472ef7bfc246eecbd696.tar.xz zen-fa40b11e35f9791bd6ca472ef7bfc246eecbd696.zip | |
Merged main.
Diffstat (limited to 'zenhttp')
| -rw-r--r-- | zenhttp/httpasio.cpp | 13 | ||||
| -rw-r--r-- | zenhttp/httpserver.cpp | 7 | ||||
| -rw-r--r-- | zenhttp/httpsys.cpp | 4 |
3 files changed, 15 insertions, 9 deletions
diff --git a/zenhttp/httpasio.cpp b/zenhttp/httpasio.cpp index e1d417d06..7a6efd884 100644 --- a/zenhttp/httpasio.cpp +++ b/zenhttp/httpasio.cpp @@ -7,7 +7,7 @@ #include <deque> #include <memory> -#include <memory_resource> +#include <vector> ZEN_THIRD_PARTY_INCLUDES_START #if ZEN_PLATFORM_WINDOWS @@ -28,7 +28,6 @@ ZEN_THIRD_PARTY_INCLUDES_END namespace zen::asio_http { using namespace std::literals; -using namespace fmt::literals; struct HttpAcceptor; struct HttpRequest; @@ -154,6 +153,14 @@ struct HttpRequest private: struct HeaderEntry { + HeaderEntry() = default; + + HeaderEntry(std::string_view InName, std::string_view InValue) + : Name(InName) + , Value(InValue) + { + } + std::string_view Name; std::string_view Value; }; @@ -1127,7 +1134,7 @@ HttpAsioServerImpl::Start(uint16_t Port, int ThreadCount) for (int i = 0; i < ThreadCount; ++i) { m_ThreadPool.emplace_back([this, Index = i + 1] { - SetCurrentThreadName("asio worker {}"_format(Index)); + SetCurrentThreadName(fmt::format("asio worker {}", Index)); try { diff --git a/zenhttp/httpserver.cpp b/zenhttp/httpserver.cpp index 84af2b2ca..62b8d11a1 100644 --- a/zenhttp/httpserver.cpp +++ b/zenhttp/httpserver.cpp @@ -400,7 +400,8 @@ HttpServerRequest::GetQueryParams() continue; } - const std::string_view Query{QueryIt, QueryEnd}; + size_t QueryLen = ptrdiff_t(QueryEnd - QueryIt); + const std::string_view Query{QueryIt, QueryLen}; size_t DelimIndex = Query.find('&', 0); @@ -415,10 +416,10 @@ HttpServerRequest::GetQueryParams() if (EqIndex != std::string_view::npos) { - std::string_view Parm{ThisQuery.data(), EqIndex}; + std::string_view Param{ThisQuery.data(), EqIndex}; ThisQuery.remove_prefix(EqIndex + 1); - Params.KvPairs.emplace_back(Parm, ThisQuery); + Params.KvPairs.emplace_back(Param, ThisQuery); } QueryIt += DelimIndex; diff --git a/zenhttp/httpsys.cpp b/zenhttp/httpsys.cpp index a17c2661c..67ff6b46b 100644 --- a/zenhttp/httpsys.cpp +++ b/zenhttp/httpsys.cpp @@ -674,8 +674,6 @@ HttpAsyncWorkRequest::HandleCompletion(ULONG IoResult, ULONG_PTR NumberOfBytesTr void HttpAsyncWorkRequest::AsyncWorkItem::Execute() { - using namespace fmt::literals; - try { HttpSysServerRequest& ThisRequest = Tx.ServerRequest(); @@ -705,7 +703,7 @@ HttpAsyncWorkRequest::AsyncWorkItem::Execute() } catch (std::exception& Ex) { - return (void)Tx.IssueNextRequest(new HttpMessageResponseRequest(Tx, 500, "Exception thrown in async work: '{}'"_format(Ex.what()))); + return (void)Tx.IssueNextRequest(new HttpMessageResponseRequest(Tx, 500, fmt::format("Exception thrown in async work: '{}'", Ex.what()))); } } |