diff options
| author | Stefan Boberg <[email protected]> | 2023-10-13 09:55:27 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-13 09:55:27 +0200 |
| commit | 74d104d4eb3735e0881f0e1fccc2df8aa4d3f57d (patch) | |
| tree | acae59dac67b4d051403f35e580201c214ec4fda /src/zenhttp/include | |
| parent | faster oplog iteration (#471) (diff) | |
| download | zen-74d104d4eb3735e0881f0e1fccc2df8aa4d3f57d.tar.xz zen-74d104d4eb3735e0881f0e1fccc2df8aa4d3f57d.zip | |
restructured zenhttp (#472)
separating the http server implementations into a directory and moved diagsvcs into zenserver since it's somewhat hard-coded for it
Diffstat (limited to 'src/zenhttp/include')
| -rw-r--r-- | src/zenhttp/include/zenhttp/diagsvcs.h | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/src/zenhttp/include/zenhttp/diagsvcs.h b/src/zenhttp/include/zenhttp/diagsvcs.h deleted file mode 100644 index 8cc869c83..000000000 --- a/src/zenhttp/include/zenhttp/diagsvcs.h +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - -#pragma once - -#include <zencore/iobuffer.h> -#include <zenhttp/httpserver.h> - -#include <filesystem> - -////////////////////////////////////////////////////////////////////////// - -namespace zen { - -/** HTTP test endpoint - - This is intended to be used to exercise basic HTTP communication infrastructure - which is useful for benchmarking performance of the server code and when evaluating - network performance / diagnosing connectivity issues - - */ -class HttpTestService : public HttpService -{ -public: - HttpTestService() {} - ~HttpTestService() = default; - - virtual const char* BaseUri() const override { return "/test/"; } - - virtual void HandleRequest(HttpServerRequest& Request) override - { - using namespace std::literals; - - auto Uri = Request.RelativeUri(); - - if (Uri == "hello"sv) - { - Request.WriteResponse(HttpResponseCode::OK, HttpContentType::kText, u8"hello world!"sv); - } - else if (Uri == "1K"sv) - { - Request.WriteResponse(HttpResponseCode::OK, HttpContentType::kBinary, m_1k); - } - else if (Uri == "1M"sv) - { - Request.WriteResponse(HttpResponseCode::OK, HttpContentType::kBinary, m_1m); - } - else if (Uri == "1M_1k"sv) - { - std::vector<IoBuffer> Buffers; - Buffers.reserve(1024); - - for (int i = 0; i < 1024; ++i) - { - Buffers.push_back(m_1k); - } - - Request.WriteResponse(HttpResponseCode::OK, HttpContentType::kBinary, Buffers); - } - else if (Uri == "1G"sv) - { - std::vector<IoBuffer> Buffers; - Buffers.reserve(1024); - - for (int i = 0; i < 1024; ++i) - { - Buffers.push_back(m_1m); - } - - Request.WriteResponse(HttpResponseCode::OK, HttpContentType::kBinary, Buffers); - } - else if (Uri == "1G_1k"sv) - { - std::vector<IoBuffer> Buffers; - Buffers.reserve(1024 * 1024); - - for (int i = 0; i < 1024 * 1024; ++i) - { - Buffers.push_back(m_1k); - } - - Request.WriteResponse(HttpResponseCode::OK, HttpContentType::kBinary, Buffers); - } - } - -private: - IoBuffer m_1m{1024 * 1024}; - IoBuffer m_1k{m_1m, 0u, 1024}; -}; - -struct HealthServiceInfo -{ - std::filesystem::path DataRoot; - std::filesystem::path AbsLogPath; - std::string HttpServerClass; - std::string BuildVersion; -}; - -/** Health monitoring endpoint - - Thji - */ -class HttpHealthService : public HttpService -{ -public: - HttpHealthService(); - ~HttpHealthService() = default; - - void SetHealthInfo(HealthServiceInfo&& Info); - - virtual const char* BaseUri() const override; - virtual void HandleRequest(HttpServerRequest& Request) override final; - -private: - HttpRequestRouter m_Router; - RwLock m_InfoLock; - HealthServiceInfo m_HealthInfo; -}; - -} // namespace zen |